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: 
#r "nuget: Microsoft.ML.AutoML, Version=0.17.2" 
#r "nuget: Microsoft.ML.Recommender"

// workaround till native library transitive references are fixed for F# interactive
let userProfile = System.Environment.GetEnvironmentVariable("UserProfile")
let packageRoot = $@"{userProfile}\.nuget\packages"
let nativeLib =  $@"{packageRoot}\microsoft.ml.cpumath\1.5.2\runtimes\win-x64\nativeassets\netstandard2.0"//CpuMathNative.dll"
let nativeLib2 = $@"{packageRoot}\microsoft.ml.recommender\0.17.2\runtimes\win-x64\native"//MatrixFactorizationNative.dll"
let path = System.Environment.GetEnvironmentVariable("path")
let path' =  path + ";" + nativeLib + ";" + nativeLib2
System.Environment.SetEnvironmentVariable("path",path')
val userProfile : string
namespace System
type Environment =
  static member CommandLine : string
  static member CurrentDirectory : string with get, set
  static member CurrentManagedThreadId : int
  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 + 2 overloads
  static member GetCommandLineArgs : unit -> string[]
  static member GetEnvironmentVariable : variable:string -> string + 1 overload
  static member GetEnvironmentVariables : unit -> IDictionary + 1 overload
  ...
  nested type SpecialFolder
  nested type SpecialFolderOption
System.Environment.GetEnvironmentVariable(variable: string) : string
System.Environment.GetEnvironmentVariable(variable: string, target: System.EnvironmentVariableTarget) : string
val packageRoot : 'a
val nativeLib : 'a
val nativeLib2 : 'a
val path : string
val path' : string
System.Environment.SetEnvironmentVariable(variable: string, value: string) : unit
System.Environment.SetEnvironmentVariable(variable: string, value: string, target: System.EnvironmentVariableTarget) : unit

More information

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