Ml_metrics is the Python implementation of metrics implementations a library of various supervised machine Learni NG evaluation metrics.
First, open the Anaconda Prompt,
Follow these steps:
1, Search Ml_metrics Package
Anaconda search-t Conda ml_metrics Using anaconda-server API site Https://api.anaconda.orgRun ' Anaconda show <USER/PACKAGE> ' to get more Details:packa Ges:name | Version | Package Types | Platforms-------------------------| ------ | --------------- | ---------------Chdoig/ml_metrics | 0.1.3 | Conda | Osx-64:machine Learning Evaluation Metricsdan_blanchard/ml_metrics | 0.1.3 | Conda | Linux-64:https://github.com/benhamner/metrics/tree/master/pythonm0nhawk/ml_metrics | 0.1.4 | Conda | Linux-64, win-32,win-64, linux-32, Osx-64found 3 packages
2, display the information of Ml_metrics package
Anaconda Show M0nhawk/ml_metrics Using Anaconda-server API site Https://api.anaconda.orgName:ml_metricsSummary:Access:publicPackage Types: condaversions:+ 0.1.3+ 0.1.4To Install this package with Conda Run:conda install--channel https://conda.anaconda.org/m0n Hawk Ml_metrics
3, install the latest version of the Ml_metrics package
[Anaconda2] C:\users\klchang>Conda Install--channel Https://conda.anaconda.org/m0nhawk ml_metrics==0.1.4Fetching Package metadata: ... Solving package Specifications:........ Package plan for installation in environment E:\users\klchang\anaconda2:the following packages would be downloaded:package | Build---------------------------|-----------------mkl-11.3.3 | 1 110.0 MB defaultsvs2008_runtime-9.00.30729.1| 1 1.2 MB defaultspython-2.7.11 | 4 23.1 MB defaultsconda-env-2.4.5 | Py27_0 KB defaultsmenuinst-1.4.1 | Py27_0 KB defaultsnumpy-1.11.0 | Py27_1 3.0 MB defaultspycosat-0.6.1 | Py27_1 KB defaultspytz-2016.4 | PY27_0 171 KB defaultspyyaml-3.11 | Py27_4 169 KB defaultsrequests-2.10.0 | Py27_0 615 KB defaultssetuptools-21.2.1 | PY27_0 763 KB defaultswheel-0.29.0 | Py27_0 121 KB defaultsconda-4.0.7 | Py27_0 228 KB defaultspip-8.1.1 | Py27_1 1.5 MB defaultspython-dateutil-2.5.3 | Py27_0 236 KB defaultspandas-0.18.1 | NP111PY27_0 7.0 MB defaultsml_metrics-0.1.4 | 0 KB M0nhawk------------------------------------------------------------total:148.4 mbthe following NEW packAges'll be installed:mkl:11.3.3-1 defaultsml_metrics:0.1.4-0 m0nhawkvs2008_runtime:9.00.30729.1-1 defaultsThe Following packages'll be updated:conda:3.18.6-py27_0 defaults-to 4.0.7-py27_0 defaultsconda-env:2.4.4-py27_2 DEFA Ults--2.4.5-py27_0 defaultsmenuinst:1.2.1-py27_0 defaults--1.4.1-py27_0 defaultsnumpy:1.10.1-py27_0 Defaults--1.11.0-py27_1 defaultspandas:0.17.0-np110py27_0 defaults--0.18.1-np111py27_0 defaultspip:7.1.2- Py27_0 defaults--8.1.1-py27_1 defaultspycosat:0.6.1-py27_0 defaults--0.6.1-py27_1 defaultspython:2.7.10-4 D Efaults--2.7.11-4 defaultspython-dateutil:2.4.2-py27_0 defaults--2.5.3-py27_0 defaultspytz:2015.6-py27_0 Defaults--2016.4-py27_0 defaultspyyaml:3.11-py27_2 defaults--3.11-py27_4 defaultsrequests:2.8.1-py27_0 Defaults--2.10.0-py27_0 defaultssetuptools:18.5-py27_0 defaults--21.2.1-py27_0 defaultswheel:0.26.0-py27_ 1 Defaults-0.29.0-py27_0 defaultsproceed ([y]/n)? ymenuinst-1.4.1 100% |###############################| time:0:00:00 161.14 kb/sfetching packages ... mkl-11.3.3-1.t 100% |###############################| time:0:02:39 725.30 kb/svs2008_runtime 100% |###############################| time:0:00:02 424.65 kb/spython-2.7.11-100% |###############################| Time:0:00:24 984.44 kb/sconda-env-2.4. 100% |###############################| time:0:00:00 101.80 kb/snumpy-1.11.0-p 100% |###############################| time:0:00:05 580.68 kb/spycosat-0.6.1-100% |###############################| time:0:00:00 97.22 kb/spytz-2016.4-py 100% |###############################| time:0:00:01 161.02 kb/spyyaml-3.11-py 100% |###############################| Time:0:00:01 104.81 kb/srequests-2.10. 100% |###############################| time:0:00:03 180.66 kb/ssetuptools-21. 100% |###############################| time:0:00:02 293.96 kb/swheel-0.29.0-p 100% |###############################| time:0:00:01 109.30 kb/sconda-4.0.7-py 100% |###############################| time:0:00:01 142.15 kb/spip-8.1.1-py27 100% |###############################| time:0:00:05 307.28 Kb/spython-dateuti 100% |###############################| time:0:00:01 160.14 kb/spandas-0.18.1-100% |###############################| time:0:00:38 189.41 kb/sml_metrics-0.1 100% |###############################| time:0:00:00 45.44 kb/sextracting Packages ... [Complete]|##################################################| 100%unlinking packages ... [Complete]|##################################################| 100%linking packages ... [Complete]|##################################################| 100%
4, Test Ml_metrics package, take apk,mapk measure function as an example, (apk is average [email protected] abbreviation, MAPK is mean average [email protected] abbreviation)
[Anaconda2] C:\users\klchang>pythonPython 2.7.11 | Anaconda 2.4.0 (64-bit) | (default, Feb 16 2016, 09:58:36) [MSC v.1500 (AMD64)] on Win32type ' help ', ' copyright ', ' credits ' or ' license ' for more information. Anaconda is brought-to-Continuum analytics.please check out:http://continuum.io/thanks and Https://anaconda.org> ;>> import ml_metrics as metrics>>> actual = [1]>>> predicted = [1,2,3,4,5]>>> print ' Ans wer=%s predicted=%s '% (actual,predicted) answer=[1] predicted=[1, 2, 3, 4, 5]>>> print ' [email protected] = ', metrics.apk (actual,predicted,5) [email protected] = 1.0>>> predicted = [2,1,3,4,5]>>> print ' answer=%s predicted=%s '% (actual, predicted) answer=[1] predicted=[2, 1, 3, 4, 5]>>> print ' [email protecte D] = ', metrics.apk (actual, predicted, 5) [email protected] = 0.5>>> predicted = [3,2,1,4,5]>>> print ' answer=%s predicted=%s '% (actual,predicted) answer=[1] predicted=[3, 2, 1, 4, 5]>>>print ' [email protected] = ', metrics.apk (actual,predicted,5) [email protected] = 0.333333333333>> >>>> predicted = [4,2,3,1,5]>>> print ' answer=%s predicted=%s '% (actual,predicted) answer=[1] Predicted=[4, 2, 3, 1, 5]>>> print ' [email protected] = ', metrics.apk (actual,predicted,5) [email Protected] = 0.25>>>>>> predicted = [2,3,4,5,1]>>> print ' answer=%s predicted=%s '% (actual, Predicted) answer=[1] predicted=[2, 3, 4, 5, 1]>>> print ' [email protected] = ', metrics.apk (actual, predicted,5) [email protected] = 0.2>>>>>> print ' [email protected] = ', metrics.mapk ([[1] , [1],[1],[1],[1]],[[1,2,3,4,5],[2,1,3,4,5],[3,2,1,4,5],[4,2,3,1,5],[4,2,3,5,1]],5] [email protected] = 0.456666666667
Resources:
Https://www.kaggle.com/wendykan/expedia-hotel-recommendations/map-k-demo
Anaconda Installing the Ml_metrics package