This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"name": "Darkmatter2", | |
"globals": | |
{ | |
"background": "#14191f", | |
"caret": "#F8F8F0", | |
"foreground": "#aec2e0", | |
"invisibles": "#3B3A32", | |
"lineHighlight": "#1b232c", | |
"selection": "#183c66", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Macroaveraged MAE and RMSE ([Baccianella et al 2009](http://nmis.isti.cnr.it/sebastiani/Publications/ISDA09.pdf)) for evaluation of ordinal classifiers. | |
""" | |
import numpy as np | |
def groupby_labels(y, yhat): | |
"""Based on https://stackoverflow.com/questions/38013778/is-there-any-numpy-group-by-function | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.stats as stats | |
def pttest(y, yhat): | |
"""Given NumPy arrays with predictions and with true values, | |
return Directional Accuracy Score, Pesaran-Timmermann statistic and its p-value | |
""" | |
size = y.shape[0] | |
pyz = np.sum(np.sign(y) == np.sign(yhat))/size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
================================================================= | |
Selecting dimensionality reduction with Pipeline and GridSearchCV | |
================================================================= | |
This example constructs a pipeline that does dimensionality | |
reduction followed by prediction with a support vector | |
classifier. It demonstrates the use of GridSearchCV and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
====================================================== | |
Classification of text documents using sparse features | |
====================================================== | |
This is an example showing how scikit-learn can be used to classify documents | |
by topics using a bag-of-words approach. This example uses a scipy.sparse | |
matrix to store the features and demonstrates various classifiers that can | |
efficiently handle sparse matrices. |