我正在使用 ML.NET 二进制分类算法和威斯康星州乳腺癌数据。训练模型后,我发现每个实例都被评估为错误。在我的测试文件中,我有 100 个实例。75 个负数和 25 个正数。因此,从指标来看,准确度为 0.75,负精度为 0.75。这意味着所有实例都使用 0(假)进行评估。
private static string trainingDataPath = Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "uploads"), "data.csv");
private static string testDataPath = Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "uploads"), "test.csv");
public bool checkDiagnostic (BreastCancerData input)
{
// set up a new machine learning context
var mlContext = new MLContext();
// load training and test data
var trainingDataView = mlContext.Data.LoadFromTextFile<BreastCancerData>(trainingDataPath, hasHeader: false, separatorChar: ',');
var testDataView = mlContext.Data.LoadFromTextFile<BreastCancerData>(testDataPath, hasHeader: false, separatorChar: ',');
// Preview the data.
//var dataPreview = trainingDataView.Preview(maxRows:700);
//var dataPreview2 = testDataView.Preview();
// the rest of the training code goes here...
var trainer = mlContext.BinaryClassification.Trainers.LinearSvm("Label", "Features");
var trainingPipeline = mlContext.Transforms.Concatenate(outputColumnName: "Features", nameof(BreastCancerData.AreaMean),
nameof(BreastCancerData.AreaSe), nameof(BreastCancerData.AreaWorst), nameof(BreastCancerData.CompactnessMean),
nameof(BreastCancerData.CompactnessSe), nameof(BreastCancerData.CompactnessWorst), nameof(BreastCancerData.ConcavePointsMean),
nameof(BreastCancerData.ConcavePointsSe), nameof(BreastCancerData.ConcavePointsWorst), nameof(BreastCancerData.ConcavityMean),
nameof(BreastCancerData.ConcavitySe), nameof(BreastCancerData.ConcavityWorst), nameof(BreastCancerData.FractalDimensionMean),
拉莫斯之舞
相关分类