-
Notifications
You must be signed in to change notification settings - Fork 1
/
ml_model_interface.ts
31 lines (30 loc) · 1.04 KB
/
ml_model_interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { TensorScriptModelInterface, TensorScriptOptions, TensorScriptProperties, } from './model_interface';
import { getScikit } from './scikitjs_singleton';
/**
* Deep Learning with Tensorflow
* @class MachineLearningModelInterface
* @implements {TensorScriptModelInterface}
*/
export class MachineLearningModelInterface extends TensorScriptModelInterface {
scikit: any;
/**
* @param {{layers:Array<Object>,compile:Object,fit:Object}} options - neural network configuration and tensorflow model hyperparameters
* @param {{model:Object,tf:Object,}} properties - extra instance properties
*/
constructor(options:TensorScriptOptions = {}, properties:TensorScriptProperties={}) {
let scikit = getScikit();
const config = {
...options,
};
super(config, properties);
this.scikit = properties.scikit || scikit;
this.type = 'MachineLearningModelInterface';
return this;
}
explain(){
return {
coefficients: this.model.coef,
intercept: this.model.intercept,
};
}
}