1 people like it.

Configure F# Interactive to use Microsoft.ML.Net

Updated to use the new "nuget:..." style references. At this time a workaround is needed to properly load some of the native libraries.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
//as of ML.Net 1.0 
#r "netstandard"
#I @"..\packages\Microsoft.ML.TimeSeries.0.12.0\lib\netstandard2.0"
#I @"..\packages\Microsoft.ML.1.0.0\lib\netstandard2.0"
#I @"..\packages\Microsoft.ML.DataView.1.0.0\lib\netstandard2.0"
#I @"..\packages\Microsoft.ML.StaticPipe.0.12.0\lib\netstandard2.0"
#I @"..\packages\System.Memory.4.5.2\lib\netstandard2.0"
#I @"..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0"
#I @"..\packages\Microsoft.ML.Ensemble.0.12.0\lib\netstandard2.0"
#I @"..\packages\Microsoft.ML.CpuMath.1.0.0\lib\netstandard2.0"

#r "System.Runtime.CompilerServices.Unsafe.dll"
#r "Microsoft.ML.CpuMath.dll"
#r "Microsoft.ML.Core.dll"
#r "Microsoft.ML.DataView.dll"
#r "Microsoft.ML.Data.dll"
//#r @"Microsoft.ML.FastTree.dll"
#r "Microsoft.ML.StaticPipe.dll"
#r "System.Memory.dll"
#r "Microsoft.ML.Transforms.dll"
#r "Microsoft.ML.Ensemble.dll"
#r "Microsoft.ML.PCA.dll"
#r "Microsoft.ML.TimeSeries.dll"

open System
let path = Environment.GetEnvironmentVariable("path")
let current = __SOURCE_DIRECTORY__
let combine a b = IO.Path.GetFullPath(IO.Path.Combine(a,b))

let path' = 
    path 
    + ";" + combine current @"..\packages\Microsoft.ML.1.0.0\runtimes\win-x64\native"
    + ";" + combine current @"..\packages\Microsoft.ML.Mkl.Redist.1.0.0\runtimes\win-x64\native"
    + ";" + combine current @"..\packages\Microsoft.ML.CpuMath.1.0.0\runtimes\win-x64\native"

Environment.SetEnvironmentVariable("path",path')
namespace System
val path : string

Full name: Script.path
type Environment =
  static member CommandLine : string
  static member CurrentDirectory : string with get, set
  static member Exit : exitCode:int -> unit
  static member ExitCode : int with get, set
  static member ExpandEnvironmentVariables : name:string -> string
  static member FailFast : message:string -> unit + 1 overload
  static member GetCommandLineArgs : unit -> string[]
  static member GetEnvironmentVariable : variable:string -> string + 1 overload
  static member GetEnvironmentVariables : unit -> IDictionary + 1 overload
  static member GetFolderPath : folder:SpecialFolder -> string + 1 overload
  ...
  nested type SpecialFolder
  nested type SpecialFolderOption

Full name: System.Environment
Environment.GetEnvironmentVariable(variable: string) : string
Environment.GetEnvironmentVariable(variable: string, target: EnvironmentVariableTarget) : string
val current : string

Full name: Script.current
val combine : a:string -> b:string -> string

Full name: Script.combine
val a : string
val b : string
namespace System.IO
type Path =
  static val DirectorySeparatorChar : char
  static val AltDirectorySeparatorChar : char
  static val VolumeSeparatorChar : char
  static val InvalidPathChars : char[]
  static val PathSeparator : char
  static member ChangeExtension : path:string * extension:string -> string
  static member Combine : [<ParamArray>] paths:string[] -> string + 3 overloads
  static member GetDirectoryName : path:string -> string
  static member GetExtension : path:string -> string
  static member GetFileName : path:string -> string
  ...

Full name: System.IO.Path
IO.Path.GetFullPath(path: string) : string
IO.Path.Combine([<ParamArray>] paths: string []) : string
IO.Path.Combine(path1: string, path2: string) : string
IO.Path.Combine(path1: string, path2: string, path3: string) : string
IO.Path.Combine(path1: string, path2: string, path3: string, path4: string) : string
val path' : string

Full name: Script.path'
Environment.SetEnvironmentVariable(variable: string, value: string) : unit
Environment.SetEnvironmentVariable(variable: string, value: string, target: EnvironmentVariableTarget) : unit

More information

Link:http://fssnip.net/7Wi
Posted:3 years ago
Author:Faisal Waris
Tags: machine learning , ml.net