Я пытаюсь использовать infer. net (https://dotnet.github.io/infer/) в Python 3.6. Для этого я установил пакет pytho nnet и скачал файл dll, который мне нужен для использования infer. net. Импорт файлов / пакетов, использование новых типов работают, но когда я пытаюсь вывести базовую c модель, я получил исключение PlatformNotSupportedException, и я не знаю, как бороться с такого рода ошибками. Кто-нибудь может мне помочь, пожалуйста? Я использую Jupyter Notebook, вот код, который я использую.
import clr
import System
import numpy as np
from System import Console
from System import Array
from System import IO
from System import Array, Double, Type
clr.AddReference("Microsoft.ML.Probabilistic")
clr.AddReference("Microsoft.ML.Probabilistic.Compiler")
clr.AddReference("Microsoft.ML.Probabilistic.Learners")
clr.AddReference("System.CodeDom")
#---------import all classes and methods from above namespaces-----------
from Microsoft.ML.Probabilistic.Distributions import *
from Microsoft.ML.Probabilistic.Models import *
from Microsoft.ML.Probabilistic.Collections import *
from Microsoft.ML.Probabilistic.Factors import *
from Microsoft.ML.Probabilistic.Math import *
from Microsoft.ML.Probabilistic.Models import Variable, VariableArray, Range, InferenceEngine
from Microsoft.ML.Probabilistic.Distributions import Gaussian, Gamma
len = Variable.New[int]()
dataRange = Range(len)
x = Variable.Array[float](dataRange)
mean = Variable.GaussianFromMeanAndVariance(0.0, 100.0).Named('mean')
precision = Variable.GammaFromShapeAndScale(1.0, 1.0).Named('precision')
x.set_Item(dataRange,
Variable.GaussianFromMeanAndPrecision(mean,
precision).ForEach(dataRange))
data = [] # System.Array.CreateInstance(float, 100)
for i in range(0, 100):
data.append(np.random.normal(42, 1))
ie = InferenceEngine()
len.ObservedValue = 100
x.ObservedValue = data
engine = InferenceEngine()
engine.ModelName = 'Gaussian_priors'
engine.Infer(mean)
---------------------------------------------------------------------------
PlatformNotSupportedException Traceback (most recent call last)
PlatformNotSupportedException: L'opération n'est pas prise en charge sur cette plateforme.
à Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
à Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
à Microsoft.ML.Probabilistic.Compiler.CodeCompiler.CompileWithCodeDom(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
à Microsoft.ML.Probabilistic.Compiler.CodeCompiler.Compile(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
The above exception was the direct cause of the following exception:
PlatformNotSupportedException Traceback (most recent call last)
<ipython-input-1-c6ab7cf71833> in <module>()
47 engine.ModelName = 'Gaussian_priors'
48
---> 49 engine.Infer(mean)
PlatformNotSupportedException: Current platform is not supported by the current compiler choice Auto. Try a different one.
à Microsoft.ML.Probabilistic.Compiler.CodeCompiler.Compile(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
à Microsoft.ML.Probabilistic.Compiler.CodeCompiler.WriteAndCompile(List`1 typeDeclarations)
à Microsoft.ML.Probabilistic.Compiler.ModelCompiler.CompileWithoutParams[T](List`1 itds)
à Microsoft.ML.Probabilistic.Models.InferenceEngine.Compile()
à Microsoft.ML.Probabilistic.Models.InferenceEngine.GetCompiledInferenceAlgorithm(Boolean inferOnlySpecifiedVars, IVariable var)
à Microsoft.ML.Probabilistic.Models.InferenceEngine.Infer(IVariable var)