Skip to content

Commit 67028eb

Browse files
committed
chore(automljs): Move from gitlab
Initial commit
1 parent 6c62e01 commit 67028eb

File tree

115 files changed

+150420
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+150420
-1
lines changed

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Windows image file caches
2+
Thumbs.db
3+
ehthumbs.db
4+
5+
# Folder config file
6+
Desktop.ini
7+
8+
# Recycle Bin used on file shares
9+
$RECYCLE.BIN/
10+
11+
# Windows Installer files
12+
*.cab
13+
*.msi
14+
*.msm
15+
*.msp
16+
17+
# Windows shortcuts
18+
*.lnk
19+
20+
# =========================
21+
# Operating System Files
22+
# =========================
23+
24+
# OSX
25+
# =========================
26+
27+
.DS_Store
28+
.AppleDouble
29+
.LSOverride
30+
31+
# Thumbnails
32+
._*
33+
34+
# Files that might appear on external disk
35+
.Spotlight-V100
36+
.Trashes
37+
38+
# Directories potentially created on remote AFP share
39+
.AppleDB
40+
.AppleDesktop
41+
Network Trash Folder
42+
Temporary Items
43+
.apdisk
44+
/nbproject/private/
45+
46+
.idea/
47+
*.pyc
48+
49+
node_modules
50+
coverage

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "Launch Chrome",
11+
"url": "http://localhost:5000",
12+
"webRoot": "${workspaceFolder}"
13+
},
14+
{
15+
"type": "node",
16+
"request": "launch",
17+
"name": "Launch Program",
18+
"program": "${workspaceFolder}/src/aitable.js"
19+
},
20+
{
21+
"type": "node",
22+
"request": "launch",
23+
"name": "Draft launch",
24+
"program": "${workspaceFolder}/src/drafts/draft.js"
25+
}
26+
]
27+
}

README.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,98 @@
1-
# automl-js
1+
# automl-js
2+
3+
Automated Machine Learning, done locally in browser or on a server with nodejs. Ground up implementation of ML algorithms for both regression and classification, such as Decision Trees, Linear Models and Gradient Boosting with Decision Trees. The implementation is benchmarked against excellent `scikit-learn` library to give quite close, albeit somewhat smaller (at most 1 percent of classification accuracy on average) score.
4+
5+
# Installation
6+
7+
The code should be used in browser using standard script import:
8+
9+
```html
10+
<script src="./dist/automljs.js"></script>
11+
```
12+
13+
This creates a global `aml` object, that can be used to instantiate the models, do data splitting and preprocessing, etc. If you wish to run it in nodejs, install the package with npm and import using `require`.
14+
15+
# Docs and examples
16+
17+
Below this section are two examples for how to use code in automl-js. Beyond this, see docs at [https://automl-js.github.io](https://automl-js.github.io) for description of objects and functions of automljs, and `tests` folder for example usage of functionality.
18+
19+
# Example automl estimator
20+
21+
```javascript
22+
// automl-js uses asynchronous functionality of JavaScript
23+
async function main(){
24+
// Each row is an observation, each column is a feature (similar to numpy)
25+
// Mixed types: categorical and numerical, missing values are handled automatically
26+
var X = [
27+
['a', 0.6],
28+
['b', -1.3],
29+
['a', 1.1],
30+
['b', -2],
31+
['a', 0.5],
32+
['b', ""], // missing value
33+
['a', 0.4],
34+
['', 1.1], // missing value
35+
['b', -0.8],
36+
['a', "1e-1"] // wrong type
37+
]
38+
39+
// Outputs are a vector / 1d array
40+
var y = ['pos', 'neg', 'pos', 'neg', 'neg', 'pos', 'neg', 'pos', 'neg', 'pos']
41+
42+
// Create a model instance
43+
var model = new aml.automl.AutoMLModel({
44+
'max_iter': 7 // specifies how many iterations you are willing to wait for result
45+
})
46+
47+
// Does internally data splitting into training and testing
48+
// Tries a bunch of ML models to see which one fits best
49+
await model.fit(X, y)
50+
51+
// Evaluate the best found model
52+
var score = await model.score(X, y)
53+
54+
// Get estimations by the model; Interface same as sklearn
55+
var y_pred = await model.predict(X)
56+
}
57+
58+
// run the async function
59+
main()
60+
```
61+
62+
# Example learning with estimator
63+
64+
The code should be run in browser. If you wish to run it in nodejs, install the package with npm and import using `require`.
65+
66+
```html
67+
<script src="./dist/automljs.js"></script>
68+
69+
<script>
70+
async function main(){
71+
// Data needs to be of numeric type for regular estimators
72+
var X = [
73+
[1, 0],
74+
[0, 1],
75+
[1, 1],
76+
[0, 0]
77+
]
78+
79+
// Outputs are a vector / 1d array
80+
var y = [1, 2, 2, 0]
81+
82+
// Create a model instance; Names of parameters are mostly similar to sklearn
83+
var model = new aml.ensemble.GradientBoostingRegressor({'n_estimators':10, 'learning_rate': 1.0, 'loss': 'ls'})
84+
85+
// Fit the model
86+
await model.fit(X, y)
87+
88+
// Evaluate the model
89+
var score = await model.score(X, y)
90+
91+
// Get estimations by the model; Interface same as sklearn
92+
var y_pred = await model.predict(X)
93+
}
94+
95+
main()
96+
</script>
97+
```
98+

0 commit comments

Comments
 (0)