Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIS_Kriging_S contrib method fails #302

Open
RomainGoussault opened this issue Dec 22, 2020 · 1 comment
Open

AIS_Kriging_S contrib method fails #302

RomainGoussault opened this issue Dec 22, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RomainGoussault
Copy link
Member

AIS_Kriging_S contrib method fails.
It now removed from the end to end tests.

How to reproduce:

    scenario = Scenario(2, [0.25, 0.75], epoch_count=4, minibatch_count=2, dataset_name='mnist',
                                    contributivity_methods=["AIS_Kriging_S"], dataset_proportion=0.1)
    exp = Experiment(scenarios_list=[scenario])
    exp.run()

Stacktrace:

      ---------------------------------------------------------------------------
      LinAlgError                               Traceback (most recent call last)
      <ipython-input-5-8d35b47f50db> in <module>
            2                                 contributivity_methods=["AIS_Kriging_S"], dataset_proportion=0.1)
            3 exp = Experiment(scenarios_list=[scenario])
    ----> 4 exp.run()
    
    ~/code/distributed-learning-contributivity/mplc/experiment.py in run(self)
        162                 else:
        163                     scenario = blank_scenario.copy(repeat_count=repeat_idx)
    --> 164                 scenario.run()
        165 
        166                 # Save scenario results
    
    ~/code/distributed-learning-contributivity/mplc/scenario.py in run(self)
        572             logger.info(f"{method}")
        573             contrib = contributivity.Contributivity(scenario=self)
    --> 574             contrib.compute_contributivity(method)
        575             self.append_contributivity(contrib)
        576             logger.info(f"Evaluating contributivity with {method}: {contrib}")
    
    ~/code/distributed-learning-contributivity/mplc/contributivity.py in compute_contributivity(self, method_to_compute, sv_accuracy, alpha, truncation, update)
       1165         elif method_to_compute == "AIS_Kriging_S":
       1166             # Contributivity 7: Adaptative importance sampling with Kriging model
    -> 1167             self.AIS_Kriging(sv_accuracy=sv_accuracy, alpha=alpha, update=update)
       1168         elif method_to_compute == "SMCS":
       1169             # Contributivity 8:  Stratified Monte Carlo
    
    ~/code/distributed-learning-contributivity/mplc/contributivity.py in AIS_Kriging(self, sv_accuracy, alpha, update)
        669             if t % update == 0:  # renew the importance density g
        670                 j = t // update
    --> 671                 make_models()
        672                 # ## compute the renormalization constant of the new importance density for all datatsets
        673                 renorms = []
    
    ~/code/distributed-learning-contributivity/mplc/contributivity.py in make_models()
        642             for k in range(n):
        643                 model_k = KrigingModel(2, cov[k])
    --> 644                 model_k.fit(datasets[k], outputs[k])
        645                 models.append(model_k)
        646             all_models.append(models)
    
    ~/code/distributed-learning-contributivity/mplc/contributivity.py in fit(self, X, Y)
         45         self.invK = np.linalg.inv(K)
         46         Ht_invK_H = H.transpose().dot(self.invK).dot(H)
    ---> 47         self.beta = np.linalg.inv(Ht_invK_H).dot(H.transpose()).dot(self.invK).dot(self.Y)
         48 
         49     def predict(self, x):
    
    <__array_function__ internals> in inv(*args, **kwargs)
    
    ~/Library/Python/3.8/lib/python/site-packages/numpy/linalg/linalg.py in inv(a)
        544     signature = 'D->D' if isComplexType(t) else 'd->d'
        545     extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
    --> 546     ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
        547     return wrap(ainv.astype(result_t, copy=False))
        548 
    
    ~/Library/Python/3.8/lib/python/site-packages/numpy/linalg/linalg.py in _raise_linalgerror_singular(err, flag)
         86 
         87 def _raise_linalgerror_singular(err, flag):
    ---> 88     raise LinAlgError("Singular matrix")
         89 
         90 def _raise_linalgerror_nonposdef(err, flag):
    
    LinAlgError: Singular matrix

@bowni @arthurPignet @Thomas-Galtier

@arthurPignet arthurPignet added the bug Something isn't working label Jan 4, 2021
@RomainGoussault
Copy link
Member Author

We have decided to remove this method.
To be done by @RomainGoussault

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants