Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Multi-Agent Accelerator for Data Science (MAADS): AutoML for Conventional ML or Historical Batch Data
Revolutionizing Data Science with Artificial Intelligence
Overview
MAADS combines Artificial Intelligence, Machine Learning and Natural Language Processing (with data engineering task automation) in one easy to use library, that allows clients to connect to the MAADS server located anywhere in the world and perform advanced analytics and embed intelligence in their organization seamlessly and fast!
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 and Prescriptive Analytics in any solution by wrapping additional code around the functions below.
To install this library a request should be made to support@otics.ca for a username and a MAADSTOKEN. Once you have these credentials then install this Python library.
Compatibility - Python 3.8 or greater - Minimal Python skills needed
Copyright
Installation
Syntax
Main functions:
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 - takes 1-2 seconds.
hyperpredictions After training, make high quality predictions - takes less than half a second (about ~100 milliseconds). Users can also generate predictions using non-python code such as JAVA. Using the maadshyperpredictions.CLASS file, java apps can call the MAADS prediction server to return predictions very fast. Other apps, using any other language, can also call the MAADS prediction server using standard TCP/IP client/server communication protocols like REST: This gives MAADS users' the maximum flexibility to integrate MAADS predictions in any solution!
You can also use hyperpredictions as an API (Python not needed) and make calls from any application using the following format: GET http://[maads server website]:[port]/[microserviceid]/?hyperpredict=[optimal algo key],[[input data]],[MAADSTOKEN]
MAADS hyper-prediction can also be used in a MICROSERVICES architecture that utilize API gateways (reverse proxies). This allows organizations to balance loads on the server and manage millions or billions of connections, to hyper-predictions, per day without experiencing latency issues.
Support functions:
Optimization:
Natural Language Processing (NLP):
Data Prepping:
First import the Python library.
import maads
Parameters:
MAADSTOKEN : string, required
CSV_local_file : string, required
feature_analysis : int, required, 1 or 0
remove_outliers : int, required, 1 or 0
has_seasonality : int, required, 1 or 0
dependent_variable : string, required
maadsurl : string, required
throttle : int, optional, Default=-1
theserverlocalname : string, optional
summer : string, optional
winter : string, optional
shoulder : string, optional
trainingpercentage : number between 40 and 100, inclusive, optional
retrainingdays : number, optional
retraindeploy : number, 0 or 1, optional
shuffle : number, 0 or 1, optional
Returns: string buffer, PDF of Results, CSV of Prediction Data
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.
2. maads.dopredictions(MAADSTOKEN,attr,pkey,inputs,maadsurl)
Parameters:
MAADSTOKEN : string, required
attr : int, required
pkey : string, required
inputs : string, required
maadsurl : string, required
Returns: string buffer
The string buffer contains the following sections:
DATA: : This contains your prediction.
3. maads.hyperpredictions(MAADSTOKEN,pkey,inputdata,host,port,use_reverse_proxy,microserviceid)
Parameters:
MAADSTOKEN : string, required
pkey : string, required
inputdata : string, required
host : string, required
port : int, required
use_reverse_proxy : int, optional, Default=0 for no reverse proxy
microserviceid : string, optional, Default is empty.
Returns: json, prediction value
4. maads.returndata(thepredictions, section_attr)
Parameters:
thepredictions : string buffer
section_attr : string buffer
This value can be any one of the values:
Returns: string buffer
5. maads.dodeletewithkey(MAADSTOKEN,pkey,maadsurl)
Parameters:
MAADSTOKEN : string, required
pkey : string buffer
maadsurl : string, required
Returns: NULL
6. maads.dolistkeys(MAADSTOKEN,maadsurl)
Parameters:
MAADSTOKEN : string, required
maadsurl : string, required
Returns: string buffer
7. maads.dolistkeyswithkey(MAADSTOKEN, pkey,maadsurl)
Parameters:
MAADSTOKEN : string, required
pkey : string buffer
maadsurl : string, required
Returns: string buffer
Returns the information (with independent variables) associated with your key.
8. maads.getpicklezip(MAADSTOKEN,pkey,url,localfolder)
Parameters:
MAADSTOKEN : string, required
pkey : string buffer
url : string, required
localfolder : string, required
Returns: ZIP File
9. maads.sendpicklezip(MAADSTOKEN, pkey,url,localfilename)
Parameters:
MAADSTOKEN : string, required
pkey : string buffer
url : string, required
localfilename : string, required
Returns: Server Response.
10. maads.deploytoprod(MAADSTOKEN, pkey,url,localfilename,ftpserver,ftpuser,ftppass)
Parameters:
MAADSTOKEN : string, required
pkey : string buffer
url : string, required
localfilename : string, optional
ftpserver : string, optional
ftpuser : string, optional
ftppass : string, optional
Returns: Server Response.
11. maads.nlp(MAADSTOKEN,url,buffer,theserverfolder,wordcount,maxkeywords)
Parameters:
MAADSTOKEN : string, required
url : string, required
buffer : string buffer, optional
theserverfolder : string buffer, optional
wordcount : int, required
maxkeywords : int, optional, Default=10
Returns: Two JSON objects separated by semi-colon.
12. maads.nlpclassify(MAADSTOKEN,iscategory,maads_rest_url,csvfile,theserverlocalname,throttle,csvonly, username,trainingpercentage,retrainingdays,retraindeploy)
Parameters:
MAADSTOKEN : string, required
iscategory : int, required
maads_rest_url : buffer, required
csvfile : string buffer, optional
theserverlocalname : string buffer, optional
throttle : int, optional, Default=-1
csvonly : number, 0 or 1, optional, Default=0
username : string, optional, Default=empty
trainingpercentage : number between 40 and 100, inclusive, optional
retrainingdays : number, optional
retraindeploy : number, 0 or 1, optional
Returns: Server Response.
13. maads.algoinfo(MAADSTOKEN,maads_rest_url,key,finddistribution)
Parameters:
MAADSTOKEN : string, required
maads_rest_url : string, required
key : string, required
finddistribution : int, optional, Default=0
Returns: JSON formatted information.
14. maads.genpdf(MAADSTOKEN,maads_rest_url,key,urltomaadsserver,savetofolder)
Parameters:
MAADSTOKEN : string, required
maads_rest_url : string, required
key : string, required
urltomaadsserver : string, required
savetofolder : string, required
Returns: PDF file.
15. maads.featureselectionjson(MAADSTOKEN,maads_rest_url,key)
Parameters:
MAADSTOKEN : string, required
maads_rest_url : string, required
key : string, required
Returns: JSON formatted information.
16. maads.optimize(MAADSTOKEN, maads_rest_url, algo1, ismin=1, objeq='1', a1cons=1, boundslimits='', forceupdate=0, algo2='', algo3='', a2cons=1,a3cons=1, iters=100, step=4, perc='min_0_max_0')
Parameters:
MAADSTOKEN : string, required
maads_rest_url : string, required
algo1 : string, required
algo2 : string, optional
algo3 : string, optional
ismin : int, optional, default=1
objeq : string, optional, default='1'
boundslimits : string, default='none'
Sets custom limits on the bounds of independent variable. The lower and upper limit bounds can be for each variable or a subset of variable. The format must be the following: variablename:[-1,0,1]:[lowervalue,equal,none]:[uppervalue,none]:[i,f]
variablename is the name of your independent variable
[-1,0,1] must be ONE of -1,0,1. -1 means values of variable name must be all negative, 0 means values can be negative or positive, 1 means values must be all positive
lowervalue is the lower bound on variable name or equal or none. If 'equal' you must specify the value in the 'uppervalue' field.
uppervalue is the upper bound on variable name or none for no bound. If no bound, MAADS will create a large value using the High value of variable.
[i,f] means i=integer, f=float, this allows users to specify the types of values for variables.
For example: If you have two variables named HOUR and MINUTE and you want to bound them, then you can specify:
"hour:1:0:23,minute:1:0:59" means hour is all positive, bounded between 0 and 23, AND minute is all positive bounded between 0 and 59. You can also just specify
"hour:1:none:none,minute:1:none:none" means hour is all positive and minute is all positive. Or,
*"hour:1:none:23,minute:1:0:none" means hour is all positive with no lower limit, and upper limit of 23, minute is all positive with lower limit of 0 and no upper limit.
"hour:1:equal:12,minute:1:0:59" means hour will equal 12 (hour=12), AND minute is all positive bounded between 0 and 59. You can also just specify
Boundslimits will give users maximum amount of flexibity when specifying bounds for constraints.
NOTE: Variablename MUST match the variables that the model is trained on. You can retrieve these EXACT names from the function: maads.dolistkeyswithkey(MAADSTOKEN, pkey,maadsurl)
a1cons : int, optional, default=1, can be 1,2,3,4
a1cons specifies the bounds on the independent variables in the constraint equations for algo 1. For example:
if a1cons=1, then MAADS will "USE MIN/MAX Of Variables For Bounds". Specifically, min <= var <= max
if a1cons=2, then MAADS will "USE MEAN +/- STD Of Variables For Bounds". Specifically, mean-std <= var <= mean+std
if a1cons=3, then MAADS will "USE MIN/MAX +/- STD Of Variables For Bounds". Specifically, min-std <= var <= max+std
if a1cons=4, then MAADS will "USE MEDIAN +/- STD Of Variables For Bounds". Specifically, median-std <= var <= median+std
a2cons : int, optional, default=1, can be 1,2,3,4. Only used if algo2 is specified.
a2cons specifies the bounds on the independent variables in the constraint equations for algo 2. For example:
if a2cons=1, then MAADS will "USE MIN/MAX Of Variables For Bounds". Specifically, min <= var <= max
if a2cons=2, then MAADS will "USE MEAN +/- STD Of Variables For Bounds". Specifically, mean-std <= var <= mean+std
if a2cons=3, then MAADS will "USE MIN/MAX +/- STD Of Variables For Bounds". Specifically, min-std <= var <= max+std
if a2cons=4, then MAADS will "USE MEDIAN +/- STD Of Variables For Bounds". Specifically, median-std <= var <= median+std
a3cons : int, optional, default=1, can be 1,2,3,4. Only used if algo3 is specified.
a3cons specifies the bounds on the independent variables in the constraint equations for algo 3. For example:
if a3cons=1, then MAADS will "USE MIN/MAX Of Variables For Bounds". Specifically, min <= var <= max
if a3cons=2, then MAADS will "USE MEAN +/- STD Of Variables For Bounds". Specifically, mean-std <= var <= mean+std
if a3cons=3, then MAADS will "USE MIN/MAX +/- STD Of Variables For Bounds". Specifically, min-std <= var <= max+std
if a3cons=4, then MAADS will "USE MEDIAN +/- STD Of Variables For Bounds". Specifically, median-std <= var <= median+std
forceupdate : int, optional, default=0, can be 1, or 0
iters : int, optional, default=100, max=500
step : int, optional, default=3, can be 1,2,3,4
Specifies how to generate the values of the independent variables for the constraint equations. For example,
if step=1, then MAADS will use a uniform distribution bounded by the choices of a1cons, a2cons, a3cons, as applicable.
if step=2, then MAADS will use a Gaussian distribution bounded by the choices of a1cons, a2cons, a3cons, as applicable.
if step=3, then MAADS will combine uniform and Gaussian by averaging to create a distribution bounded by the choices of a1cons, a2cons, a3cons, as applicable.
if step=4, then MAADS will find values around an epsilon distance, using the standard deviation, around the values that have historically led to lowest or highest values depending on your optimization problem.
perc : string, optional, default='min_0_max_0' - 0 means 0%, values should be greater and equal to 0.
Returns: JSON formatted information.
17. maads.balancebigdata(localcsvfile,numberofbins,maxrows,outputfile,bincutoff,distcutoff,startcolumn=0)
Parameters:
localcsvfile : string, required
numberofbins : int, required
maxrows : int, required
outputfile : string, required
bincutoff : float, required.
distcutoff : float, required.
startcolumn : int, optional
RETURNS: Returns a detailed JSON object and new balaced dataset written to outputfile.
Simple Example
#############################################################
Author: Sebastian Maurice, PhD
Copyright by Sebastian Maurice 2018
All rights reserved.
Email: Sebastian.maurice@otics.ca
#############################################################
** IMPORT THE MAAADS LIBRARY* import maads
** IMPORT ADDITIONAL LIBRARY** import imp
** LOAD ANY DATABASE LIBRARY TO STORE PREDICTIONS** sqlconn = imp.load_source('sqlconn','C:\sqlsrvconnpython.py')
** OPEN DATABASE CONNECTION** connection = sqlconn.doconnect()
cur = connection.cursor()
** TEST DATA **
inputs = '1/12/2018,37.76896'
pkey='demouser_test2log_csv' MAADSTOKEN=XXXXXXXXXXXXXXXXXXXX username='demouser'
url='/maads/remotemasstreamremote.php'
** DO TRAINING - SERVER RETURNS A KEY THAT POINTS TO THE BEST ALGORITHM** thedata=maads.dotraining(MAADSTOKEN,'C:\test2log.csv',1,0,0,'depvar',url)
** PARSE RETURNED DATA** pkey=maads.returndata(thedata,'PKEY:')
algo=maads.returndata(thedata,'ALGO0:')
accuracy=maads.returndata(thedata,'ACCURACY0:')
** DO PREDICTIONS WITH THE RETURNED KEY** thepredictions=maads.dopredictions(MAADSTOKEN,0,pkey,inputs,url)
** PARSE THE DATA** prediction=maads.returndata(thepredictions,'DATA:')
** INSERT PREDICTIONS TO ANY DATABASE TABLE** 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()
** CLOSE THE DATABASE CONNECTION** cur.close()
FAQs
Multi-Agent Accelerator for Data Science (MAADS)
We found that maads demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.