Añadidas algunas etiquetas
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using Microsoft.ML;
|
||||
#define SIMULATION
|
||||
#undef TEST_MODELS
|
||||
|
||||
using Microsoft.ML;
|
||||
using Microsoft.ML.AutoML;
|
||||
using Microsoft.ML.Data;
|
||||
using Microsoft.ML.Trainers;
|
||||
@@ -31,7 +34,7 @@ namespace testML
|
||||
{
|
||||
XSSFWorkbook wb;
|
||||
//using (FileStream file = new FileStream(@"C:\Users\miguel.maldonado\Downloads\entrenar_IAMenos.xlsx", FileMode.Open, FileAccess.Read))
|
||||
using (FileStream file = new FileStream(@"C:\Users\miki_\Downloads\entrenar_IA_2.xlsx", FileMode.Open, FileAccess.Read))
|
||||
using (FileStream file = new FileStream(@"C:\Users\miguel.maldonado\Downloads\entrenar_IA.xlsx", FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
wb = new XSSFWorkbook(file);
|
||||
}
|
||||
@@ -136,9 +139,11 @@ namespace testML
|
||||
}
|
||||
}
|
||||
|
||||
#if SIMULATION
|
||||
|
||||
S4i_Simulador.S4i_SimularCruces.Run(tmpData);
|
||||
|
||||
/*foreach (var key in firstRow.Keys)
|
||||
#else
|
||||
foreach (var key in firstRow.Keys)
|
||||
{
|
||||
if (key.StartsWith("DESCENDIENTE_S4i") ||
|
||||
key.StartsWith("DESCENDIENTE_SNP"))
|
||||
@@ -170,7 +175,8 @@ namespace testML
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Press enter to Exit");
|
||||
@@ -205,7 +211,7 @@ namespace testML
|
||||
var objectFilename = columnToPredict + "." + hash + ".dll";
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
MLContext mlContext = new MLContext();
|
||||
@@ -237,16 +243,16 @@ namespace testML
|
||||
var loadMethodObj = loadMethod.MakeGenericMethod(classType);
|
||||
var data = (IDataView)loadMethodObj.Invoke(mlContext.Data, new object[] { dataConverted, null });
|
||||
|
||||
#region Cortamos los datos de entrenamiento en (Datos para entenar y Datos para hacer el test de precisión)
|
||||
#region Cortamos los datos de entrenamiento en (Datos para entenar y Datos para hacer el test de precisión)
|
||||
|
||||
DataOperationsCatalog.TrainTestData dataSplit = mlContext.Data.TrainTestSplit(data, testFraction: 0.5);
|
||||
IDataView trainData = dataSplit.TrainSet;
|
||||
IDataView testData = dataSplit.TestSet;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
#region Preparamos los datos de entrada y salida
|
||||
#region Preparamos los datos de entrada y salida
|
||||
|
||||
|
||||
var columnNameAndTypes = new Dictionary<string, Type>();
|
||||
@@ -317,14 +323,15 @@ namespace testML
|
||||
|
||||
#endregion
|
||||
|
||||
/*
|
||||
//Entrenamos el modelo
|
||||
//ITransformer model = pipe.Fit(trainData);
|
||||
|
||||
#region Hacemos un test para medir el % de error
|
||||
#if TEST_MODELS
|
||||
//Entrenamos el modelo
|
||||
//ITransformer model = pipe.Fit(trainData);
|
||||
|
||||
// Use trained model to make inferences on test data
|
||||
IDataView testDataPredictions = result.Model.Transform(testData);
|
||||
#region Hacemos un test para medir el % de error
|
||||
|
||||
// Use trained model to make inferences on test data
|
||||
IDataView testDataPredictions = result.Model.Transform(testData);
|
||||
|
||||
// Extract model metrics and get RSquared
|
||||
RegressionMetrics trainedModelMetrics = mlContext.Regression.Evaluate(testDataPredictions, labelColumnName: columnInference.LabelColumnName);
|
||||
@@ -332,10 +339,10 @@ namespace testML
|
||||
|
||||
Console.WriteLine("ModelMetrics: {0}", rSquared);
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
#region Ponemos a prueba haciendo algunas predicciones
|
||||
#region Ponemos a prueba haciendo algunas predicciones
|
||||
|
||||
var predictionFunction = mlContext.Model.CreatePredictionEngine<Data, DataPrediction>(result.Model);
|
||||
|
||||
@@ -350,7 +357,7 @@ namespace testML
|
||||
Console.WriteLine("Found: {0:#,##0.00}\tExpected: {1:#,##0.00}\t\tDiff: {2:#,##0.00}", p.IntegerNumber, expected, expected - p.IntegerNumber);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user