This library allows users to harness the power of agent-based computing using hundreds of advanced linear and non-linear algorithms. Users can easily integrate Predictive Analytics in any solution by wrapping additional code around the functions below. The system can:
1. Automatically analyse your data and perform feature selection to determine which variables are more
important than others
2. Automatically model your data for seasonality: Winter, Shoulder, and Summer seasons
3. Automatically clean your data for outliers
4. Automatically make predictions using the BEST algorithm (out of hundreds of advanced algorithms) that
best model your data
5. Do all this in minutes
To install this library a request should be made to the system administrator sebastian.maurice@gmail.com for a username and password. Once you have these credentials then install this Python library.
- Python 3.5 or greater
- Minimal Python skills needed
pip install maads
This assumes you have Downloaded Python and installed it on your computer.
There are literally two lines of code you need to write to train your data and make predictions:
- dotraining - Executes hundreds of agents, running hundreds of advanced algorithms and completes in minutes. A master agent then chooses the BEST algorithm that best models your data.
- dopredictions - After training, make high quality predictions.
- dolistkeys - List all of the keys associated with the data you have analysed.
- dolistkeyswithkey - List data associated with a single key.
- dodeletewithkey - Permanently delete all data associated with your key.
- returndata - Returns data from the string buffer.
import maads
1. maads.dotraining(CSV_local_file, username, password, feature_analysis, remove_outliers, has_seasonality, dependent_variable, your_company_name, your_email)
Parameters:
CSV_local_file : string, required
A local comma-separated-file (csv) with Date in the first column. Date must be MM/DD/YYYY format.
All other data must be numbers.
username : string, required
A username issued by the system administrator.
password : string, required
A password issued by the system administrator.
feature_analysis : int, required, 1 or 0
If 1, then a feature analysis will be done on your file. If 0, no analysis is done.
remove_outliers : int, required, 1 or 0
If 1, then outliers will be removed from your data. If 0, no outliers are removed.
has_seasonality : int, required, 1 or 0
If 1, then your data will be modeled for seasonality: Winter, Summer, Shoulder. If 0, then your data will
not be modeled for seasonality. If modeling for seasonality, ensure you have enough data points that
covers the seasons, usually 1 year of data.
dependent_variable : string, required
This is the dependent variable in your file. All other variables will be modeled as independent variables.
your_company_name : string, required
Indicate your company name, the one associated with your username.
your_email : string, required
Indicate your email, the one associated with your username.
Returns: string buffer
The string buffer contains the following sections:
DATA: : This consists of the feature selection results
PKEY: : This is the key to the BEST algorithm and must be used when making predictions.
Parameters:
attr : int, required
This value should be 0. It may change to other values in the future.
pkey : string, required
This value must be retrieved from dotraining. Note you can store PKEY after you have trained your file.
Training does not have to run before predictions, as training occurs more infrequently.
inputs : string, required
This is a row of input data that must match the independent variables in your CSV. For example, if your
trained file is: Date, A, B, C, D and A is your dependent variable, then your inputs must be:
Date, B, C, D
username : string, required
A username issued by the system administrator.
password : string, required
A password issued by the system administrator.
your_company_name : string, required
Indicate your company name, the one associated with your username.
your_email : string, required
Indicate your email, the one associated with your username.
Returns: string buffer
The string buffer contains the following sections:
DATA: : This contains your prediction.
Parameters:
thepredictions : string buffer
This value is returned from dopredictions.
section_attr : string buffer
This value can be any one of the values:
PKEY: : This returns the key from the dotraining function. Note the semi-colon.
DATA: : This returns the data from the dotraining or dopredictions functions. Note the semi-colon.
ALGO0: : This returns the BEST algorithm determined by MAADS - without seasonality.
ACCURACY0: : This returns the forecast accuracy for the BEST algorithm - without seasonaility.
SEASON0: : This returns allseason - for no seasonality.
ALGO1: : This returns the BEST algorithm determined by MAADS for WINTER.
ACCURACY1: : This returns the forecast accuracy for the BEST algorithm for WINTER.
SEASON1: : This returns WINTER.
ALGO2: : This returns the BEST algorithm determined by MAADS for SUMMER.
ACCURACY2: : This returns the forecast accuracy for the BEST algorithm for SUMMER.
SEASON2: : This returns SUMMER.
ALGO3: : This returns the BEST algorithm determined by MAADS for SHOULDER season.
ACCURACY3: : This returns the forecast accuracy for the BEST algorithm for SHOULDER season.
SEASON3: : This returns SHOULDER.
Returns: string buffer
The string buffer contains the prediction or the key or the feature analysis.
Parameters:
username : string buffer
The username given to you by system administrator.
password : string buffer
The password given to you by system administrator.
company : string buffer
Your company assicated with your username.
email : string buffer
Your email associated with your username.
pkey : string buffer
The key you want deleted. This can be attained from dolistkeys function.
Returns: NULL
Deletes all files and tables associated with the key permanently.
Parameters:
username : string buffer
The username given to you by system administrator.
password : string buffer
The password given to you by system administrator.
company : string buffer
Your company assicated with your username.
email : string buffer
Your email associated with your username.
Returns: string buffer
Lists all the keys associated with your username.
Parameters:
username : string buffer
The username given to you by system administrator.
password : string buffer
The password given to you by system administrator.
company : string buffer
Your company assicated with your username.
email : string buffer
Your email associated with your username.
pkey : string buffer
The key you want returned.
Returns: string buffer
Returns the information (with independent variables) associated with your key.
#############################################################
Author: Sebastian Maurice, PhD
Copyright by Sebastian Maurice 2018
All rights reserved.
Email: Sebastian.maurice@gmail.com
#############################################################
import maads
import imp
sqlconn = imp.load_source('sqlconn','C:\sqlsrvconnpython.py')
connection = sqlconn.doconnect()
cur = connection.cursor()
inputs = '1/12/2018,37.76896'
username='demouser'
password='XXXXX'
pkey='demouser_test2log_csv'
company='otics'
email='sebastian.maurice@gmail.com'
thedata=maads.dotraining('C:\test2log.csv',username,password,1,0,0,'depvar','otics',email)
pkey=maads.returndata(thedata,'PKEY:')
algo=maads.returndata(thedata,'ALGO0:')
accuracy=maads.returndata(thedata,'ACCURACY0:')
thepredictions=maads.dopredictions(0,pkey,inputs,username,'XXXXXX',company,email)
prediction=maads.returndata(thepredictions,'DATA:')
forecastdate=inputs.split(',')[0]
predictionvalue=prediction[2]
accuracy=prediction[3]
SQL="INSERT INTO PREDICTIONS VALUES('%s','%s','%s','%s','%s',%.3f,%.3f)" % (forecastdate,username,pkey,company,inputs,predictionvalue,accuracy)
cur.execute(SQL)
cur.commit()
cur.close()