sagivba / machinelearningutils Goto Github PK
View Code? Open in Web Editor NEWA set of useful tools for machine learning projects
License: MIT License
A set of useful tools for machine learning projects
License: MIT License
class LinearModelUtils
def get_formula
def rmse
def rmsle
def mae
def model_info_ record
return ModelInfoRecord
class ModelInfo(list)
class ModelInfoRecord
def init
linear regression:
better_dummies:
splitting values by ranges or function
for example:
(
column: hour,
{
rush_hours : [7,8,9, ],
back_hour : [15,16,17]
others: [1:6. 10:14, 18:24]
}
)
will split the "hour" column in our df into 3 columns : rush_hours ,back_hour,others
from sklearn import datasets
from MachineLearningUtils.UsefulPlots import VisPlotPlayGround
from matplotlib import cm
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
def main():
iris = datasets.load_iris()
_df=data1 = pd.DataFrame(data= np.c_[iris['data'], iris['target']],
columns= iris['feature_names'] + ['target'])
print (_df.info())
# exit()
plotter=VisPlotPlayGround(df=_df, ggplot=True, cmap=cm.jet)
cmaps = [m for m in cm.datad if not m.endswith("_r")]
print(sorted(cmaps))
for c in sorted(cmaps):
plotter.show_colormap(c)
plt.show()
if name == 'main':
main()
def init(self,df,targert_name)
def plot_releshenships()
"""
smart plot the relashenships between target and ther colums
"""
add examples of small plots in the main readme file
add more examples in the example directory with readme file cointaining some short eamples
aget fig and matrix of axess and return fig
Don't test visualization, test different datasets using None and np.NaN
Test for the returned object and their attributes.
Check that the Utils does not throw exceptions
from sklearn.metrics import classification_report
from sklearn.metrics import accuracy_score
methods:
add_columns_one_to_many(self,df_master,df_details,function,master_columns_lst,details_columns_lst)
for row in df_master[master_columns_lst,:]:
df_details[details_columns_lst] where joined with row
add columns to master_columns_lst function(row,)
returns df_master with_new_columns
def plot_confusion_matrix(self,
cm, classes,
normalize=True,
title='Confusion matrix',
cmap=plt.cm.Blues):
This method should prints and plots the confusion matrix.
Normalization can be applied by setting normalize=True
.
split_to_columns(column,split_func,splited_columns_name) : returns tuple of colomns
drop_columns(df,columns_list) returns df without the columns_list
apply_by_dict(df, **kward)
for key, value in kwargs.iteritems():
if key not in list(df):
print warn not in columns list
continue
if value is function:
value=[value]
if value int iterable:
print warn
for f in value
df[key]=df[key].apply(f)
return df
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.