CNTK c# logistic regression w and b variable values

僤鯓⒐⒋嵵緔 提交于 2019-12-22 10:58:13

问题


I know CNTK for C# is kind of new but I hope someone can help me out. I was folling this logistic regression example in python: https://github.com/Microsoft/CNTK/blob/master/Tutorials/CNTK_101_LogisticRegression.ipynb to run this C# example: https://github.com/Microsoft/CNTK/blob/master/Examples/TrainingCSharp/Common/LogisticRegression.cs

I changed a few lines to display the result and the code runs without errors but I would like to get the values of the weight matrix and bias vector so I can draw in my chart a line between 2 classes. Does someone know which variable contains these values and how to output them? trainer variable? classifierOutput function?


回答1:


When you create the linear model, you have the weightParam and biasParam parameters. Here is how you can get data from these parameters:

NDArrayView weightArrayView = weightParam.Value();
Value weightValue = new Value(weightArrayView);
IList<IList<float>> weightData = weightValue.GetDenseData<float>(weightParam);


来源:https://stackoverflow.com/questions/46682816/cntk-c-sharp-logistic-regression-w-and-b-variable-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!