本文整理汇总了C#中Dataset.GetDoubleValues方法的典型用法代码示例。如果您正苦于以下问题:C# Dataset.GetDoubleValues方法的具体用法?C# Dataset.GetDoubleValues怎么用?C# Dataset.GetDoubleValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dataset
的用法示例。
在下文中一共展示了Dataset.GetDoubleValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportData
public override IClusteringProblemData ImportData(string path) {
var csvFileParser = new TableFileParser();
csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path));
Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
// turn of input variables that are constant in the training partition
var allowedInputVars = new List<string>();
var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
if (trainingIndizes.Count() >= 2) {
foreach (var variableName in dataset.DoubleVariables) {
if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0)
allowedInputVars.Add(variableName);
}
} else {
allowedInputVars.AddRange(dataset.DoubleVariables);
}
ClusteringProblemData clusteringData = new ClusteringProblemData(dataset, allowedInputVars);
int trainingPartEnd = trainingIndizes.Last();
clusteringData.TrainingPartition.Start = trainingIndizes.First();
clusteringData.TrainingPartition.End = trainingPartEnd;
clusteringData.TestPartition.Start = trainingPartEnd;
clusteringData.TestPartition.End = csvFileParser.Rows;
clusteringData.Name = Path.GetFileName(path);
return clusteringData;
}
示例2: ImportData
public override IRegressionProblemData ImportData(string path) {
TableFileParser csvFileParser = new TableFileParser();
csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path));
Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
string targetVar = dataset.DoubleVariables.Last();
// turn off input variables that are constant in the training partition
var allowedInputVars = new List<string>();
var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
if (trainingIndizes.Count() >= 2) {
foreach (var variableName in dataset.DoubleVariables) {
if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
variableName != targetVar)
allowedInputVars.Add(variableName);
}
} else {
allowedInputVars.AddRange(dataset.DoubleVariables.Where(x => !x.Equals(targetVar)));
}
IRegressionProblemData regressionData = new RegressionProblemData(dataset, allowedInputVars, targetVar);
var trainingPartEnd = trainingIndizes.Last();
regressionData.TrainingPartition.Start = trainingIndizes.First();
regressionData.TrainingPartition.End = trainingPartEnd;
regressionData.TestPartition.Start = trainingPartEnd;
regressionData.TestPartition.End = csvFileParser.Rows;
regressionData.Name = Path.GetFileName(path);
return regressionData;
}