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.AutoML;
|
||||||
using Microsoft.ML.Data;
|
using Microsoft.ML.Data;
|
||||||
using Microsoft.ML.Trainers;
|
using Microsoft.ML.Trainers;
|
||||||
@@ -31,7 +34,7 @@ namespace testML
|
|||||||
{
|
{
|
||||||
XSSFWorkbook wb;
|
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\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);
|
wb = new XSSFWorkbook(file);
|
||||||
}
|
}
|
||||||
@@ -136,9 +139,11 @@ namespace testML
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
S4i_Simulador.S4i_SimularCruces.Run(tmpData);
|
#if SIMULATION
|
||||||
|
|
||||||
/*foreach (var key in firstRow.Keys)
|
S4i_Simulador.S4i_SimularCruces.Run(tmpData);
|
||||||
|
#else
|
||||||
|
foreach (var key in firstRow.Keys)
|
||||||
{
|
{
|
||||||
if (key.StartsWith("DESCENDIENTE_S4i") ||
|
if (key.StartsWith("DESCENDIENTE_S4i") ||
|
||||||
key.StartsWith("DESCENDIENTE_SNP"))
|
key.StartsWith("DESCENDIENTE_SNP"))
|
||||||
@@ -170,7 +175,8 @@ namespace testML
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("Press enter to Exit");
|
Console.WriteLine("Press enter to Exit");
|
||||||
@@ -205,7 +211,7 @@ namespace testML
|
|||||||
var objectFilename = columnToPredict + "." + hash + ".dll";
|
var objectFilename = columnToPredict + "." + hash + ".dll";
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
MLContext mlContext = new MLContext();
|
MLContext mlContext = new MLContext();
|
||||||
@@ -237,16 +243,16 @@ namespace testML
|
|||||||
var loadMethodObj = loadMethod.MakeGenericMethod(classType);
|
var loadMethodObj = loadMethod.MakeGenericMethod(classType);
|
||||||
var data = (IDataView)loadMethodObj.Invoke(mlContext.Data, new object[] { dataConverted, null });
|
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);
|
DataOperationsCatalog.TrainTestData dataSplit = mlContext.Data.TrainTestSplit(data, testFraction: 0.5);
|
||||||
IDataView trainData = dataSplit.TrainSet;
|
IDataView trainData = dataSplit.TrainSet;
|
||||||
IDataView testData = dataSplit.TestSet;
|
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>();
|
var columnNameAndTypes = new Dictionary<string, Type>();
|
||||||
@@ -317,14 +323,15 @@ namespace testML
|
|||||||
|
|
||||||
#endregion
|
#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
|
#region Hacemos un test para medir el % de error
|
||||||
IDataView testDataPredictions = result.Model.Transform(testData);
|
|
||||||
|
// Use trained model to make inferences on test data
|
||||||
|
IDataView testDataPredictions = result.Model.Transform(testData);
|
||||||
|
|
||||||
// Extract model metrics and get RSquared
|
// Extract model metrics and get RSquared
|
||||||
RegressionMetrics trainedModelMetrics = mlContext.Regression.Evaluate(testDataPredictions, labelColumnName: columnInference.LabelColumnName);
|
RegressionMetrics trainedModelMetrics = mlContext.Regression.Evaluate(testDataPredictions, labelColumnName: columnInference.LabelColumnName);
|
||||||
@@ -332,10 +339,10 @@ namespace testML
|
|||||||
|
|
||||||
Console.WriteLine("ModelMetrics: {0}", rSquared);
|
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);
|
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);
|
Console.WriteLine("Found: {0:#,##0.00}\tExpected: {1:#,##0.00}\t\tDiff: {2:#,##0.00}", p.IntegerNumber, expected, expected - p.IntegerNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -300,6 +300,8 @@ FROM CruceItem C");
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Console.WriteLine("Ready");
|
||||||
|
Console.ReadLine();
|
||||||
|
|
||||||
var limit = individuos.Length * individuos.Length;
|
var limit = individuos.Length * individuos.Length;
|
||||||
var current = 0;
|
var current = 0;
|
||||||
@@ -402,15 +404,18 @@ FROM CruceItem C");
|
|||||||
|
|
||||||
for (var c = 0; c < files.Length; c++)
|
for (var c = 0; c < files.Length; c++)
|
||||||
{
|
{
|
||||||
count++;
|
|
||||||
//if (count > 5) break;
|
|
||||||
|
|
||||||
var filename = files[c];
|
var filename = files[c];
|
||||||
|
|
||||||
|
|
||||||
var name = Path.GetFileNameWithoutExtension(filename);
|
var name = Path.GetFileNameWithoutExtension(filename);
|
||||||
|
|
||||||
var matchName = columnByModelName.Match(name);
|
var matchName = columnByModelName.Match(name);
|
||||||
|
if(!matchName.Success )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
if (count > 10) break;
|
||||||
|
|
||||||
Console.Write(string.Format("{0}/{1} Loading: {2}... ", c + 1, files.Length, matchName.Groups[1].Value));
|
Console.Write(string.Format("{0}/{1} Loading: {2}... ", c + 1, files.Length, matchName.Groups[1].Value));
|
||||||
|
|
||||||
@@ -450,7 +455,6 @@ FROM CruceItem C");
|
|||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<package id="NPOI.Excel" version="2.1.1" targetFramework="net48" />
|
<package id="NPOI.Excel" version="2.1.1" targetFramework="net48" />
|
||||||
<package id="NumSharp.Lite" version="0.1.8" targetFramework="net48" />
|
<package id="NumSharp.Lite" version="0.1.8" targetFramework="net48" />
|
||||||
<package id="Protobuf.Text" version="0.4.0" targetFramework="net48" />
|
<package id="Protobuf.Text" version="0.4.0" targetFramework="net48" />
|
||||||
<package id="SharpZipLib" version="1.4.0" targetFramework="net48" />
|
<package id="SharpZipLib" version="0.86.0" targetFramework="net48" />
|
||||||
<package id="SkiaSharp" version="2.88.3" targetFramework="net48" />
|
<package id="SkiaSharp" version="2.88.3" targetFramework="net48" />
|
||||||
<package id="SkiaSharp.NativeAssets.Linux.NoDependencies" version="2.88.3" targetFramework="net48" />
|
<package id="SkiaSharp.NativeAssets.Linux.NoDependencies" version="2.88.3" targetFramework="net48" />
|
||||||
<package id="SkiaSharp.NativeAssets.macOS" version="2.88.3" targetFramework="net48" />
|
<package id="SkiaSharp.NativeAssets.macOS" version="2.88.3" targetFramework="net48" />
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FFSoft.SQLiteUtilities">
|
<Reference Include="FFSoft.SQLiteUtilities">
|
||||||
<HintPath>..\..\..\..\..\..\Desarrollo\SQLiteUtilities\SQLiteUtilities\bin\Debug\FFSoft.SQLiteUtilities.dll</HintPath>
|
<HintPath>..\..\SQLiteUtilities\SQLiteUtilities\bin\Debug\FFSoft.SQLiteUtilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
|
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
|
||||||
|
|||||||
Reference in New Issue
Block a user