本文整理汇总了C#中IMLMethod.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IMLMethod.GetType方法的具体用法?C# IMLMethod.GetType怎么用?C# IMLMethod.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMLMethod
的用法示例。
在下文中一共展示了IMLMethod.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Create a SVM trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is SupportVectorMachine))
{
throw new EncogError(
"SVM Train training cannot be used on a method of type: "
+ method.GetType().FullName);
}
double defaultGamma = 1.0d/((SupportVectorMachine) method).InputCount;
double defaultC = 1.0d;
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
double gamma = holder.GetDouble(MLTrainFactory.PropertyGamma,
false, defaultGamma);
double c = holder.GetDouble(MLTrainFactory.PropertyC, false,
defaultC);
var result = new SVMTrain((SupportVectorMachine) method, training);
result.Gamma = gamma;
result.C = c;
return result;
}
示例2: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
if (!(method is SupportVectorMachine))
{
throw new EncogError("SVM Train training cannot be used on a method of type: " + method.GetType().FullName);
}
double defaultValue = 1.0 / ((double) ((SupportVectorMachine) method).InputCount);
while (true)
{
double num4;
SVMTrain train;
double num2 = 1.0;
IDictionary<string, string> theParams = ArchitectureParse.ParseParams(argsStr);
ParamsHolder holder = new ParamsHolder(theParams);
double num3 = holder.GetDouble("GAMMA", false, defaultValue);
do
{
num4 = holder.GetDouble("C", false, num2);
train = new SVMTrain((SupportVectorMachine) method, training) {
Gamma = num3
};
}
while (((uint) defaultValue) > uint.MaxValue);
if ((((uint) num2) + ((uint) num3)) <= uint.MaxValue)
{
train.C = num4;
return train;
}
}
}
示例3: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is BasicPNN))
{
throw new EncogError("PNN training cannot be used on a method of type: " + method.GetType().FullName);
}
return new TrainBasicPNN((BasicPNN) method, training);
}
示例4: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
if (!(method is SOMNetwork))
{
throw new EncogError("Cluster SOM training cannot be used on a method of type: " + method.GetType().FullName);
}
return new SOMClusterCopyTraining((SOMNetwork) method, training);
}
示例5: NetworkSize
public static int NetworkSize(IMLMethod network)
{
if (!(network is IMLEncodable))
{
throw new NeuralNetworkError("This machine learning method cannot be encoded:" + network.GetType().FullName);
}
return ((IMLEncodable) network).EncodedArrayLength();
}
示例6: ArrayToNetwork
public static void ArrayToNetwork(double[] array, IMLMethod network)
{
if (!(network is IMLEncodable))
{
throw new NeuralNetworkError("This machine learning method cannot be encoded:" + network.GetType().FullName);
}
((IMLEncodable) network).DecodeFromArray(array);
}
示例7: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is BasicNetwork))
{
throw new EncogError("SCG training cannot be used on a method of type: " + method.GetType().FullName);
}
return new ScaledConjugateGradient((BasicNetwork) method, training);
}
示例8: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string args)
{
if (!(method is RBFNetwork))
{
throw new EncogError("RBF-SVD training cannot be used on a method of type: " + method.GetType().FullName);
}
return new SVDTraining((RBFNetwork) method, training);
}
示例9: ArrayToNetwork
/// <summary>
/// Use an array to populate the memory of the neural network.
/// </summary>
///
/// <param name="array">An array of doubles.</param>
/// <param name="network">The network to encode.</param>
public static void ArrayToNetwork(double[] array,
IMLMethod network)
{
if (network is IMLEncodable)
{
((IMLEncodable) network).DecodeFromArray(array);
return;
}
throw new NeuralNetworkError(Error
+ network.GetType().FullName);
}
示例10: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
if (method is IContainsFlat)
{
ParamsHolder holder = new ParamsHolder(ArchitectureParse.ParseParams(argsStr));
double initialUpdate = holder.GetDouble("INIT_UPDATE", false, 0.1);
double maxStep = holder.GetDouble("MAX_STEP", false, 50.0);
if ((((uint) initialUpdate) - ((uint) maxStep)) >= 0)
{
return new ResilientPropagation((IContainsFlat) method, training, initialUpdate, maxStep);
}
}
throw new EncogError("RPROP training cannot be used on a method of type: " + method.GetType().FullName);
}
示例11: Create
/// <summary>
/// Create a LMA trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is BasicNetwork))
{
throw new EncogError(
"LMA training cannot be used on a method of type: "
+ method.GetType().FullName);
}
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
var result = new LevenbergMarquardtTraining(
(BasicNetwork) method, training);
return result;
}
示例12: Create
/// <summary>
/// Create a LMA trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is BasicNetwork))
{
throw new EncogError(
"LMA training cannot be used on a method of type: "
+ method.GetType().FullName);
}
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
bool useReg = holder.GetBoolean(
MLTrainFactory.PropertyBayesianRegularization, false, false);
var result = new LevenbergMarquardtTraining(
(BasicNetwork) method, training) {UseBayesianRegularization = useReg};
return result;
}
示例13: Create
/// <summary>
/// Create a RPROP trainer.
/// </summary>
///
/// <param name="method">The method to use.</param>
/// <param name="training">The training data to use.</param>
/// <param name="argsStr">The arguments to use.</param>
/// <returns>The newly created trainer.</returns>
public IMLTrain Create(IMLMethod method,
IMLDataSet training, String argsStr)
{
if (!(method is IContainsFlat))
{
throw new EncogError(
"RPROP training cannot be used on a method of type: "
+ method.GetType().FullName);
}
IDictionary<String, String> args = ArchitectureParse.ParseParams(argsStr);
var holder = new ParamsHolder(args);
double initialUpdate = holder.GetDouble(
MLTrainFactory.PropertyInitialUpdate, false,
RPROPConst.DefaultInitialUpdate);
double maxStep = holder.GetDouble(
MLTrainFactory.PropertyMaxStep, false,
RPROPConst.DefaultMaxStep);
return new ResilientPropagation((IContainsFlat) method, training,
initialUpdate, maxStep);
}
示例14: Create
public IMLTrain Create(IMLMethod method, IMLDataSet training, string argsStr)
{
bool flag;
LevenbergMarquardtTraining training3;
if (method is BasicNetwork)
{
flag = new ParamsHolder(ArchitectureParse.ParseParams(argsStr)).GetBoolean("BAYES_REG", false, false);
training3 = new LevenbergMarquardtTraining((BasicNetwork) method, training);
if (3 == 0)
{
LevenbergMarquardtTraining training2;
return training2;
}
}
else if (0 == 0)
{
throw new EncogError("LMA training cannot be used on a method of type: " + method.GetType().FullName);
}
training3.UseBayesianRegularization = flag;
if (0 == 0)
{
}
return training3;
}
示例15: NetworkToArray
public static double[] NetworkToArray(IMLMethod network)
{
int num = NetworkSize(network);
if (!(network is IMLEncodable))
{
throw new NeuralNetworkError("This machine learning method cannot be encoded:" + network.GetType().FullName);
}
double[] encoded = new double[num];
((IMLEncodable) network).EncodeToArray(encoded);
return encoded;
}