I have found this page: https://docs.chainer.org/en/stable/reference/initializers.html
How to use xavier weight initializer to initialize weight in chainer?
If you mean the xavier filler of Caffe, LeCunUniform and GlorotUniform are the corresponding initializers of Chainer (the former uses fan_in while the latter uses (fan_in + fan_out)/2).
Related
I am having trouble navigating the source code to see how the design variables in the initial population for the SimpleGA and DifferentialEvolution Drivers are set. Is there some sort of Latin Hypercube sampling of the design variable ranges? Do the initial values I set in my problem instance get used like they would for the other drivers (Scipy and pyOptSparse)?
Many thanks,
Garrett
For these two drivers, the initial value in the model is not used. Its not even clear to me what it would mean to use that value directly, since you need a stochastically generated population --- but I'm admittedly not an expert on the latest GA population initialization methods. However, I can answer the question of how they do get initialized as of OpenMDAO V3.17:
Simple GA Driver:
This driver does seem to use an LHS sampling like this:
new_gen = np.round(lhs(self.lchrom, self.npop, criterion='center',
random_state=random_state))
new_gen[0] = self.encode(x0, vlb, vub, bits)
Differential Evolution Driver:
This driver uses a uniform random distribution like this:
population = rng.random([self.npop, self.lchrom]) * (vub - vlb) + vlb # scale to bounds
Admittedly, it doesn't make a whole lot of sense why the intialization methods are different, and perhaps there should be some option to pick from a set of methods or provide your own initial population somehow. A POEM and/or pull-request to improve this would be most welcome.
What does this line do in jdk 1.8 version?
import java.util.Vector;//is this still used
static Vector<Boolean>isprime = new Vector<>(1000001);
I wrote it outside main inside class and when called its size it showed 0. Doesn't it be a vector of 1000001 elements each initialised with true by default.
No.
First of all, Vector is obsolete and you should use ArrayList.
Secondly, the argument you pass is not the initial size of the list, but it's capacity, which represents the amount of items you can add before it needs to resize its internal storage.
The example given here uses two optimizers for encoder and decoder individually. Why? And when to do like that?
If you have multiple networks (in the sense of multiple objects that inherit from nn.Module), you have to do this for a simple reason: When construction a torch.nn.optim.Optimizer object, it takes the parameters which should be optimized as an argument. In your case:
encoder_optimizer = optim.Adam(encoder.parameters(), lr=learning_rate)
decoder_optimizer = optim.Adam(decoder.parameters(), lr=learning_rate)
This also gives you the freedom to vary parameters as the learning rate independently. If you don't need that, you could create a new class inheriting from nn.Module and containing both networks, encoder and decoder or create a set of parameters to give to the optimizer as explained here:
nets = [encoder, decoder]
parameters = set()
for net in nets:
parameters |= set(net.parameters())
where | is the union operator for sets in this context.
I am using Modelica in Scilab 5.5.1 and I want to use an algorithm clause to calculate the varable lambda in every step
I wrote the calculation in a function:
function lambda_calc
input Real K;
output Real lambda;
algorithm
lambda := 3*K;
end lambda_calc;
and when I try to call lambda = lambda_calc( 1 ); I get this error:
-------Modelica translator error message:-----
---------------------------------------------------
Translator v1.2 for Scicos from Modelica 2.x to flat Modelica
Copyright (C)
2005-2007 Imagine,
2007-2008 LMS-Imagine
Build date is not known (2008-04-01).
---------------------------------------------------
ERROR 2000:
--- Use of not yet implemented feature: Use of class reference in expression is allowed only for external function call
--- Execution step: Code generation for class "lambda_calc"
I tried various places for the function. I also put just the algorithm in the regarded model. All lead to similar errors. I doubt that the possibility of algorithms and functions is not yet implemented. Does anyone see my mistake?
According to official modelica webside modelicac just contains a subset of modelica. It can solve implicit equations but algorithms or functions are not mentioned. Therefore I guess that it is really not implemented.
You could try some other Modelica compiler. Are you bound to Scilab?
In packages like marray and limma, when complex objects are loaded, they contain "members variables" that are accessed using the # symbol. What does this mean and how does it differ from the $ symbol?
See ?'#':
Description:
Extract the contents of a slot in a object with a formal (S4)
class structure.
Usage:
object#name
...
The S language has two object systems, known informally as S3 and S4.
S3 objects, classes and methods have been available in R
from the beginning, they are informal, yet very interactive.
S3 was first described in the White Book (Statistical Models in S).
S3 is not a real class system, it mostly is a set of naming
conventions.
S4 objects, classes and methods are much more formal and
rigorous, hence less interactive. S4 was first described
in the Green Book (Programming with Data). In R it is
available through the methods package, attached by default
since version 1.7.0.
See also this document: S4 Classes and Methods.
As the others have said, the # symbol is used with S4 classes, but here is a note from Google's R Style Guide: "Use S3 objects and methods unless there is a strong reason to use S4 objects or methods."
You will want to read up on S4 classes which use the # symbol.