CNTK c# logistic regression w and b variable value

2019-07-14 19:50发布

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条回答
老娘就宠你
2楼-- · 2019-07-14 20:17

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);
查看更多
登录 后发表回答