From 23581b1cf04734fad4f19e71fa4ebedbf6d64be4 Mon Sep 17 00:00:00 2001 From: a-parida12 Date: Sat, 20 Oct 2018 16:47:23 +0200 Subject: [PATCH 1/3] Minor typo error fixed link --- .../CNTK_104_Finance_Timeseries_Basic_with_Pandas_Numpy.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tutorials/CNTK_104_Finance_Timeseries_Basic_with_Pandas_Numpy.ipynb b/Tutorials/CNTK_104_Finance_Timeseries_Basic_with_Pandas_Numpy.ipynb index a592bc11af95..60c83853093d 100644 --- a/Tutorials/CNTK_104_Finance_Timeseries_Basic_with_Pandas_Numpy.ipynb +++ b/Tutorials/CNTK_104_Finance_Timeseries_Basic_with_Pandas_Numpy.ipynb @@ -806,7 +806,7 @@ "## Evaluation\n", "Here we take the output of our test set and compute the probabilities from the softmax function. Since we have probabilities we want to trade when there is a \"higher\" chance that we will be right, instead of just a >50% chance that the market will go in one direction. The goal is to find a signal, instead of trying to classify the market. Since the market is so noisy we want to only trade when we have an \"edge\" on the market. Moreover, trading frequently has higher fees (you have to pay each time you trade).\n", "\n", - "We will say that if the prediction probability is greater than 55% (in either direction) we will take a position in the market. If it shows that the market will be up the next day with greater than 55% probability, we will take a 1-day long. If it is greater than a 55% chance that the next day will be below today's position we will take 1-day [short] (http://www.investopedia.com/university/shortselling/shortselling1.asp)(the same as borrowing a stock and buying it back). \n", + "We will say that if the prediction probability is greater than 55% (in either direction) we will take a position in the market. If it shows that the market will be up the next day with greater than 55% probability, we will take a 1-day long. If it is greater than a 55% chance that the next day will be below today's position we will take 1-day [short](http://www.investopedia.com/university/shortselling/shortselling1.asp) (the same as borrowing a stock and buying it back). \n", "\n", "We will then evaluate this timeseries performance by looking at some more metrics: average monthly return, standard deviation of monthly returns, the [Sharpe ratio](http://www.investopedia.com/terms/s/sharperatio.asp), and the [Maximum drawdown](https://en.wikipedia.org/wiki/Drawdown_%28economics%29). The Sharpe ratio is the average return minus the risk free rate (which is basically zero) over the standard deviation of returns normalized to a year. \n", "\n", @@ -1089,7 +1089,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.4" + "version": "3.6.3" } }, "nbformat": 4, From 3310df0bb61d85f0a5416235a1d7bd2f12a9173b Mon Sep 17 00:00:00 2001 From: a-parida12 Date: Sun, 21 Oct 2018 01:23:37 +0200 Subject: [PATCH 2/3] Added accuracy metric --- Tutorials/CNTK_101_LogisticRegression.ipynb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Tutorials/CNTK_101_LogisticRegression.ipynb b/Tutorials/CNTK_101_LogisticRegression.ipynb index 013f8f454bb8..b6d68282f176 100644 --- a/Tutorials/CNTK_101_LogisticRegression.ipynb +++ b/Tutorials/CNTK_101_LogisticRegression.ipynb @@ -724,8 +724,12 @@ } ], "source": [ - "print(\"Label :\", [np.argmax(label) for label in labels])\n", - "print(\"Predicted:\", [np.argmax(x) for x in result])" + "labelList=[np.argmax(label) for label in labels]\n", + "predictedList=[np.argmax(x) for x in result]\n", + "Accuracy=1-np.sum(np.array(labelList)-np.array(predictedList))/np.size(labelList)\n", + "print(\"Label :\", labelList)\n", + "print(\"Predicted:\", predictedList)\n", + "print(\"Accuracy:\", Accuracy*100,\"%\")" ] }, { @@ -820,16 +824,16 @@ "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3.0 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.3" } }, "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file + "nbformat_minor": 1 +} From 43b5a30dad720acc29a2a5c4015704605ddaf33f Mon Sep 17 00:00:00 2001 From: a-parida12 Date: Sun, 21 Oct 2018 01:39:12 +0200 Subject: [PATCH 3/3] Added Metric Added accuracy metric for the prediction --- Tutorials/CNTK_101_LogisticRegression.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tutorials/CNTK_101_LogisticRegression.ipynb b/Tutorials/CNTK_101_LogisticRegression.ipynb index b6d68282f176..6265c9701ae8 100644 --- a/Tutorials/CNTK_101_LogisticRegression.ipynb +++ b/Tutorials/CNTK_101_LogisticRegression.ipynb @@ -726,7 +726,7 @@ "source": [ "labelList=[np.argmax(label) for label in labels]\n", "predictedList=[np.argmax(x) for x in result]\n", - "Accuracy=1-np.sum(np.array(labelList)-np.array(predictedList))/np.size(labelList)\n", + "Accuracy=1-np.sum(np.absolute(np.array(labelList)-np.array(predictedList)))/np.size(labelList)\n", "print(\"Label :\", labelList)\n", "print(\"Predicted:\", predictedList)\n", "print(\"Accuracy:\", Accuracy*100,\"%\")"