本文整理了Java中gov.sandia.cognition.math.matrix.Vector.set()
方法的一些代码示例,展示了Vector.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.set()
方法的具体详情如下:
包路径:gov.sandia.cognition.math.matrix.Vector
类名称:Vector
方法名:set
[英]Sets the value for an element at the zero-based index from the vector. It throws an ArrayIndexOutOfBoundsException if the index is out of range. It is a convenience method for setElement.
[中]在向量的从零开始的索引处设置元素的值。如果索引超出范围,它会抛出ArrayIndexOutOfBoundsException。对于setElement来说,这是一种方便的方法。
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-common-core
/**
* Copies the values from the given Collection. It does this by iterating
* through collection and initializing by iterating through them
* in the order specified by the collection. Thus, this should probably
* not be used with collections that do not have a very well determined
* iteration order, like a HashSet (as such, LinkedHashSet may be a better
* option to preserve insertion order).
*
* @param values
* Values to create a vector from. Cannot be null and cannot contain
* null values.
* @return
* A vector of dimensionality equal to the size of the given
* collection and whose values are initialized to the values in the
* collection in order of iteration.
*/
public VectorType copyValues(
final Collection<? extends Number> values)
{
final VectorType v = this.createVector(values.size());
int index = 0;
for (final Number value : values)
{
v.set(index, value.doubleValue());
index++;
}
return v;
}
代码示例来源:origin: algorithmfoundry/Foundry
/**
* Copies the values from the given Collection. It does this by iterating
* through collection and initializing by iterating through them
* in the order specified by the collection. Thus, this should probably
* not be used with collections that do not have a very well determined
* iteration order, like a HashSet (as such, LinkedHashSet may be a better
* option to preserve insertion order).
*
* @param values
* Values to create a vector from. Cannot be null and cannot contain
* null values.
* @return
* A vector of dimensionality equal to the size of the given
* collection and whose values are initialized to the values in the
* collection in order of iteration.
*/
public VectorType copyValues(
final Collection<? extends Number> values)
{
final VectorType v = this.createVector(values.size());
int index = 0;
for (final Number value : values)
{
v.set(index, value.doubleValue());
index++;
}
return v;
}
代码示例来源:origin: algorithmfoundry/Foundry
/**
* Copies the values from the given Collection. It does this by iterating
* through collection and initializing by iterating through them
* in the order specified by the collection. Thus, this should probably
* not be used with collections that do not have a very well determined
* iteration order, like a HashSet (as such, LinkedHashSet may be a better
* option to preserve insertion order).
*
* @param values
* Values to create a vector from. Cannot be null and cannot contain
* null values.
* @return
* A vector of dimensionality equal to the size of the given
* collection and whose values are initialized to the values in the
* collection in order of iteration.
*/
public VectorType copyValues(
final Collection<? extends Number> values)
{
final VectorType v = this.createVector(values.size());
int index = 0;
for (final Number value : values)
{
v.set(index, value.doubleValue());
index++;
}
return v;
}
代码示例来源:origin: algorithmfoundry/Foundry
/**
* Creates a vector from the given map of indices to values.
*
* @param dimensionality
* The dimensionality of the vector. Cannot be negative.
* @param map
* The map of indices to values to fill in the vector. All indices
* must be 0-based and between 0 (inclusive) and dimensionality
* (exclusive). Cannot be null.
* @return
* A new vector with elements initialized to the ones in the map.
*/
public VectorType copyMap(
final int dimensionality,
final Map<Integer, ? extends Number> map)
{
ArgumentChecker.assertIsNotNull("map", map);
final VectorType result = this.createVectorCapacity(dimensionality,
map.size());
for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet())
{
result.set(entry.getKey(), entry.getValue().doubleValue());
}
return result;
}
代码示例来源:origin: algorithmfoundry/Foundry
/**
* Creates a vector from the given map of indices to values.
*
* @param dimensionality
* The dimensionality of the vector. Cannot be negative.
* @param map
* The map of indices to values to fill in the vector. All indices
* must be 0-based and between 0 (inclusive) and dimensionality
* (exclusive). Cannot be null.
* @return
* A new vector with elements initialized to the ones in the map.
*/
public VectorType copyMap(
final int dimensionality,
final Map<Integer, ? extends Number> map)
{
ArgumentChecker.assertIsNotNull("map", map);
final VectorType result = this.createVectorCapacity(dimensionality,
map.size());
for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet())
{
result.set(entry.getKey(), entry.getValue().doubleValue());
}
return result;
}
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-common-core
/**
* Creates a vector from the given map of indices to values.
*
* @param dimensionality
* The dimensionality of the vector. Cannot be negative.
* @param map
* The map of indices to values to fill in the vector. All indices
* must be 0-based and between 0 (inclusive) and dimensionality
* (exclusive). Cannot be null.
* @return
* A new vector with elements initialized to the ones in the map.
*/
public VectorType copyMap(
final int dimensionality,
final Map<Integer, ? extends Number> map)
{
ArgumentChecker.assertIsNotNull("map", map);
final VectorType result = this.createVectorCapacity(dimensionality,
map.size());
for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet())
{
result.set(entry.getKey(), entry.getValue().doubleValue());
}
return result;
}
代码示例来源:origin: algorithmfoundry/Foundry
this.inputsTransposed.get(entry.getIndex()).set(i,
entry.getValue());
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-learning-core
this.inputsTransposed.get(entry.getIndex()).set(i,
entry.getValue());
代码示例来源:origin: algorithmfoundry/Foundry
this.inputsTransposed.get(entry.getIndex()).set(i,
entry.getValue());
代码示例来源:origin: algorithmfoundry/Foundry
@Override
public Vector sample(
final Random random)
{
// Create the result vector.
final int K = this.getParameters().getDimensionality();
final Vector y = VectorFactory.getDenseDefault().createVector(K);
double sum = 0.0;
for (int i = 0; i < K; i++)
{
final double yi = GammaDistribution.sampleStandard(
this.parameters.get(i), random);
y.set(i, yi);
sum += yi;
}
if (sum != 0.0)
{
y.scaleEquals(1.0 / sum);
}
return y;
}
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-learning-core
@Override
public Vector sample(
final Random random)
{
// Create the result vector.
final int K = this.getParameters().getDimensionality();
final Vector y = VectorFactory.getDenseDefault().createVector(K);
double sum = 0.0;
for (int i = 0; i < K; i++)
{
final double yi = GammaDistribution.sampleStandard(
this.parameters.get(i), random);
y.set(i, yi);
sum += yi;
}
if (sum != 0.0)
{
y.scaleEquals(1.0 / sum);
}
return y;
}
代码示例来源:origin: algorithmfoundry/Foundry
@Override
public Vector sample(
final Random random)
{
// Create the result vector.
final int K = this.getParameters().getDimensionality();
final Vector y = VectorFactory.getDenseDefault().createVector(K);
double sum = 0.0;
for (int i = 0; i < K; i++)
{
final double yi = GammaDistribution.sampleStandard(
this.parameters.get(i), random);
y.set(i, yi);
sum += yi;
}
if (sum != 0.0)
{
y.scaleEquals(1.0 / sum);
}
return y;
}
代码示例来源:origin: algorithmfoundry/Foundry
y.set(i, yin);
sum += yin;
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-learning-core
y.set(i, yin);
sum += yin;
代码示例来源:origin: algorithmfoundry/Foundry
y.set(i, yin);
sum += yin;
代码示例来源:origin: algorithmfoundry/Foundry
final double actual = example.getOutput();
final double error = actual - prediction;
errors.set(i, error);
(oldWeight * sumOfSquares + derivative.dot(errors))
/ (sumOfSquares + this.weightRegularization);
weights.set(j, newWeight);
for (int i = 0; i < this.dataSize; i++)
factorTimesInput.set(i,
this.dataList.get(i).getInput().dot(factorRow));
代码示例来源:origin: gov.sandia.foundry/gov-sandia-cognition-learning-core
final double actual = example.getOutput();
final double error = actual - prediction;
errors.set(i, error);
(oldWeight * sumOfSquares + derivative.dot(errors))
/ (sumOfSquares + this.weightRegularization);
weights.set(j, newWeight);
for (int i = 0; i < this.dataSize; i++)
factorTimesInput.set(i,
this.dataList.get(i).getInput().dot(factorRow));
代码示例来源:origin: algorithmfoundry/Foundry
final double actual = example.getOutput();
final double error = actual - prediction;
errors.set(i, error);
(oldWeight * sumOfSquares + derivative.dot(errors))
/ (sumOfSquares + this.weightRegularization);
weights.set(j, newWeight);
for (int i = 0; i < this.dataSize; i++)
factorTimesInput.set(i,
this.dataList.get(i).getInput().dot(factorRow));
内容来源于网络,如有侵权,请联系作者删除!