Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Fsx script not working

Aberta
#985 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
38/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
fsharp
Domínio
machine-learning

Direção de pesquisa

Comece executando o script .fsx fornecido e inspecione a falha em LoadFromEnumerable no trace de Project.fsproj.fsx, especialmente o membro option Price do F#. Determine se scripts .fsx são compatíveis com este exemplo e se o erro de tipo IDataView relatado é esperado; considera-se concluído quando houver um diagnóstico confirmado e o exemplo estiver funcionando ou a limitação estiver documentada.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Is .fsx not supported ?

I can't reproduce the simple demo in F# script , this doesnt seem to work

#r "nuget: Microsoft.ML"

open Microsoft.ML
open Microsoft.ML.Data

[<CLIMutable>]
type HouseData =
    { [<ColumnName("Size")>] Size: float32
      [<ColumnName("Price")>] Price: float32 option }

[<CLIMutable>]
type Prediction =
    { [<ColumnName("Score")>] Price: float32 }


let mlContext = new MLContext()

// 1. Import or create training data
let houseData = [| { Size = 1.1F; Price = Some(1.2F) };
                   { Size = 1.9F; Price = Some(2.3F) };
                   { Size = 2.8F; Price = Some(3.0F) };
                   { Size = 3.4F; Price = Some(3.7F) } |]
let trainingData = mlContext.Data.LoadFromEnumerable(houseData)

// 2. Specify data preparation and model training pipeline
let pipeline = 
    EstimatorChain()
        .Append(
            mlContext.Transforms.Concatenate("Features", [| "Size" |])
        )
        .Append(
            mlContext.Regression.Trainers
                .Sdca(labelColumnName = "Price", maximumNumberOfIterations = 100)
        )

// 3. Train model
let model = pipeline.Fit(trainingData)

// 4. Make a prediction
let size = { Size = 2.5F  ; Price = None }

let predictionFunc = 
    mlContext.Model.CreatePredictionEngine<HouseData, Prediction>(model)

let price = predictionFunc.Predict(size)

printfn "Predicted price for size: %f sq ft= %f" (size.Size * 1000.0F) (price.Price * 100.0F)
// Predicted price for size: 2500.0 sq ft= 261.979980

here is the error

/Users/admin/.packagemanagement/nuget/Projects/54657--8671ee2c-1953-4d65-be3f-818b53cc0f76/Project.fsproj : warning NU1701: Package 'System.Xml.Linq 3.5.21022.801' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.
/Users/admin/.packagemanagement/nuget/Projects/54657--8671ee2c-1953-4d65-be3f-818b53cc0f76/Project.fsproj : warning NU1701: Package 'System.Xml.Linq 3.5.21022.801' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.
[Loading /Users/admin/.packagemanagement/nuget/Projects/54657--8671ee2c-1953-4d65-be3f-818b53cc0f76/Project.fsproj.fsx]
module FSI_0015.Project.fsproj

System.ArgumentOutOfRangeException: Could not determine an IDataView type and registered custom types for member Price@ (Parameter 'rawType')
   at Microsoft.ML.Data.InternalSchemaDefinition.GetVectorAndItemType(String name, Type rawType, IEnumerable`1 attributes, Boolean& isVector, Type& itemType)
   at Microsoft.ML.Data.InternalSchemaDefinition.GetVectorAndItemType(MemberInfo memberInfo, Boolean& isVector, Type& itemType)
   at Microsoft.ML.Data.SchemaDefinition.Create(Type userType, Direction direction)
   at Microsoft.ML.Data.InternalSchemaDefinition.Create(Type userType, Direction direction)
   at Microsoft.ML.Data.DataViewConstructionUtils.CreateFromEnumerable[TRow](IHostEnvironment env, IEnumerable`1 data, SchemaDefinition schemaDefinition)
   at Microsoft.ML.DataOperationsCatalog.LoadFromEnumerable[TRow](IEnumerable`1 data, SchemaDefinition schemaDefinition)
   at <StartupCode$FSI_0016>.$FSI_0016.main@() in /Users/admin/Repositories/scripts/mlanonimizer.fsx:line 380
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Stopped due to error
Linguagem predominante
PowerShell
Estrelas
4.7k
Forks
2.7k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de dotnet/machinelearning-samples

Todas as issues de dotnet/machinelearning-samples

Issues semelhantes

Mais issues de Machine Learning

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.