Azure ML Scripting with Python
Evangelist at Microsoft @timmyreilly Timmyreilly.com
Free Machine Learning Platform https://studio.azureml.net/
Full ML Documentation: https://azure.microsoft.com/en-us/documentation/services/machine-learning/
Python ML Documentation: https://azure.microsoft.com/en-us/documentation/articles/machine-learning-execute-python-scripts/
Gallery of Projects: https://gallery.cortanaanalytics.com/
Gallery of Projects tagged Python: https://gallery.cortanaanalytics.com/browse/?skip=0&orderby=trending%20desc&tags=%5B%22Python%22%5D
Breast Cancer Correlation Matrix: https://gallery.cortanaanalytics.com/Experiment/Correlation-Matrix-2
def azureml\_main(dataframe1 = None): import numpy as np import pandas as pd import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt cm=dataframe1.corr() fig=plt.figure() plt.imshow(cm,interpolation='nearest') plt.xticks(list(range(0,len(cm.columns))),list(cm.columns.values), rotation=45) plt.yticks(list(range(0,len(cm.columns))),list(cm.columns.values)) plt.colorbar()
fig.savefig("CorrelationPlot.png")
return pd.DataFrame(cm),
Feature Importance with sklearn https://gallery.cortanaanalytics.com/Experiment/Feature-Importance-with-sklearn-2
import numpy as np import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt import pandas as pd
from sklearn.ensemble import ExtraTreesClassifier
def azureml\_main(iris\_data): X = iris\_data[["sepal-length","sepal-width","petal-length","petal-width"]] Y = iris\_data["Class"] etc = ExtraTreesClassifier(n\_estimators=250, random\_state=0) etc.fit(X,Y) feat\_imp = etc.feature\_importances\_ std = np.std([tree.feature\_importances\_ for tree in etc.estimators\_],\ axis=0) indices = np.argsort(feat\_imp)[::-1] length\_fp = len(indices)
fig = plt.figure() plt.title("Feature importances") plt.bar(range(length\_fp), feat\_imp[indices],\ color="r", yerr=std[indices], align="center") plt.xticks(range(length\_fp), indices) plt.xlim([-1, length\_fp]) plt.xlabel("Feature") plt.ylabel("Importance") fig.savefig("Feature\_Importance.png") return iris\_data
Beer Forecasting Example: https://gallery.cortanaanalytics.com/Experiment/Forecasting-Beer-Consumption-2