Mam problem z przekonwertowaniem object
na KeyValuePair.Key
. Podpis metody wygląda następująco:
public EstimatorChain<RegressionPredictionTransformer<PoissonRegressionModelParameters>> GetRegressionPipeline(MLContext context, KeyValuePair<Type, object> algorithm)
A konwersja: (algorithm.Key)algorithm.Value
or algorithm.Value as algorithm.Key
rzuca wyjątkiem:
algorithm is a variable but is used like a type
Jak poprawnie przekonwertować na typ klucza Key
? Zakładając (dla przykładu) że Value
to LbfgsPoissonRegressionTrainer something = new LbfgsPoissonRegressionTrainer();
Czy powinienem użyć refleksji? Jeśli tak, to jak?