diff --git a/package.json b/package.json index b8582407..f77a797e 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,9 @@ "typescript": "^4.5.4" }, "jest": { + "testPathIgnorePatterns" : [ + "/src/index.test.ts" + ], "testEnvironment": "node", "preset": "ts-jest", "globals": { diff --git a/src/cluster/kmeans.test.ts b/src/cluster/KMeans.test.ts similarity index 98% rename from src/cluster/kmeans.test.ts rename to src/cluster/KMeans.test.ts index 86388b19..6aa15ea9 100644 --- a/src/cluster/kmeans.test.ts +++ b/src/cluster/KMeans.test.ts @@ -1,4 +1,4 @@ -import { KMeans } from './kmeans' +import { KMeans } from './KMeans' // Next steps: Improve on kmeans cluster testing describe('KMeans', () => { @@ -40,7 +40,7 @@ describe('KMeans', () => { it('should save kmeans model', () => { const expectedResult = { - name: 'kmeans', + name: 'KMeans', nClusters: 2, init: 'random', maxIter: 300, diff --git a/src/cluster/kmeans.ts b/src/cluster/KMeans.ts similarity index 98% rename from src/cluster/kmeans.ts rename to src/cluster/KMeans.ts index 09fb4c52..d5810cd1 100644 --- a/src/cluster/kmeans.ts +++ b/src/cluster/KMeans.ts @@ -71,7 +71,7 @@ export class KMeans extends Serialize { clusterCenters: tf.Tensor2D /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'kmeans' + name = 'KMeans' constructor({ nClusters = 8, @@ -145,7 +145,7 @@ export class KMeans extends Serialize { } /** - * Converts 2D input into a 1D Tensor which holds the Kmeans cluster Class label + * Converts 2D input into a 1D Tensor which holds the KMeans cluster Class label * @param X The 2D Matrix that you wish to cluster */ public predict(X: Scikit2D): tf.Tensor1D { diff --git a/src/compose/columnTransformer.test.ts b/src/compose/ColumnTransformer.test.ts similarity index 79% rename from src/compose/columnTransformer.test.ts rename to src/compose/ColumnTransformer.test.ts index a2506a0a..063da473 100644 --- a/src/compose/columnTransformer.test.ts +++ b/src/compose/ColumnTransformer.test.ts @@ -1,6 +1,6 @@ -import { ColumnTransformer } from './columnTransformer' -import { MinMaxScaler } from '../preprocessing/minMaxScaler' -import { SimpleImputer } from '../impute/simpleImputer' +import { ColumnTransformer } from './ColumnTransformer' +import { MinMaxScaler } from '../preprocessing/MinMaxScaler' +import { SimpleImputer } from '../impute/SimpleImputer' import * as dfd from 'danfojs-node' describe('ColumnTransformer', function () { diff --git a/src/compose/columnTransformer.ts b/src/compose/ColumnTransformer.ts similarity index 99% rename from src/compose/columnTransformer.ts rename to src/compose/ColumnTransformer.ts index d5f7200a..0f89059a 100644 --- a/src/compose/columnTransformer.ts +++ b/src/compose/ColumnTransformer.ts @@ -69,7 +69,7 @@ export class ColumnTransformer { remainder: Transformer | 'drop' | 'passthrough' /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'columntransformer' + name = 'ColumnTransformer' constructor({ transformers = [], diff --git a/src/dummy/dummyClassifier.test.ts b/src/dummy/DummyClassifier.test.ts similarity index 95% rename from src/dummy/dummyClassifier.test.ts rename to src/dummy/DummyClassifier.test.ts index fde16412..858c5adc 100644 --- a/src/dummy/dummyClassifier.test.ts +++ b/src/dummy/DummyClassifier.test.ts @@ -1,4 +1,4 @@ -import { DummyClassifier } from './dummyClassifier' +import { DummyClassifier } from './DummyClassifier' describe('DummyClassifier', function () { it('Use DummyClassifier on simple example (mostFrequent)', function () { @@ -62,7 +62,7 @@ describe('DummyClassifier', function () { ] const y = [10, 20, 20, 30] const expectedResult = { - name: 'dummyclassifier', + name: 'DummyClassifier', EstimatorType: 'classifier', constant: 20, strategy: 'mostFrequent', diff --git a/src/dummy/dummyClassifier.ts b/src/dummy/DummyClassifier.ts similarity index 99% rename from src/dummy/dummyClassifier.ts rename to src/dummy/DummyClassifier.ts index bb76748d..c74a9a01 100644 --- a/src/dummy/dummyClassifier.ts +++ b/src/dummy/DummyClassifier.ts @@ -85,7 +85,7 @@ export class DummyClassifier extends ClassifierMixin { classes: number[] | string[] /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'dummyclassifier' + name = 'DummyClassifier' constructor({ strategy = 'mostFrequent', diff --git a/src/dummy/dummyRegressor.test.ts b/src/dummy/DummyRegressor.test.ts similarity index 96% rename from src/dummy/dummyRegressor.test.ts rename to src/dummy/DummyRegressor.test.ts index e88c9574..04299b7e 100644 --- a/src/dummy/dummyRegressor.test.ts +++ b/src/dummy/DummyRegressor.test.ts @@ -1,4 +1,4 @@ -import { DummyRegressor } from './dummyRegressor' +import { DummyRegressor } from './DummyRegressor' describe('DummyRegressor', function () { it('Use DummyRegressor on simple example (mean)', function () { @@ -65,7 +65,7 @@ describe('DummyRegressor', function () { ] const y = [10, 12, 30] const saveResult = { - name: 'dummyregressor', + name: 'DummyRegressor', EstimatorType: 'regressor', strategy: 'constant', constant: 10 diff --git a/src/dummy/dummyRegressor.ts b/src/dummy/DummyRegressor.ts similarity index 99% rename from src/dummy/dummyRegressor.ts rename to src/dummy/DummyRegressor.ts index c669b872..124b2249 100644 --- a/src/dummy/dummyRegressor.ts +++ b/src/dummy/DummyRegressor.ts @@ -84,7 +84,7 @@ export class DummyRegressor extends RegressorMixin { quantile?: number /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'dummyregressor' + name = 'DummyRegressor' constructor({ strategy = 'mean', diff --git a/src/ensemble/votingClassifier.test.ts b/src/ensemble/VotingClassifier.test.ts similarity index 94% rename from src/ensemble/votingClassifier.test.ts rename to src/ensemble/VotingClassifier.test.ts index 69e2eb92..d741c00a 100644 --- a/src/ensemble/votingClassifier.test.ts +++ b/src/ensemble/VotingClassifier.test.ts @@ -1,7 +1,7 @@ -import { makeVotingClassifier, VotingClassifier } from './votingClassifier' -import { DummyClassifier } from '../dummy/dummyClassifier' +import { makeVotingClassifier, VotingClassifier } from './VotingClassifier' +import { DummyClassifier } from '../dummy/DummyClassifier' -import { LogisticRegression } from '../linear_model/logisticRegression' +import { LogisticRegression } from '../linear_model/LogisticRegression' describe('VotingClassifier', function () { it('Use VotingClassifier on simple example (voting = hard)', async function () { diff --git a/src/ensemble/votingClassifier.ts b/src/ensemble/VotingClassifier.ts similarity index 98% rename from src/ensemble/votingClassifier.ts rename to src/ensemble/VotingClassifier.ts index 35d92853..5db1241e 100644 --- a/src/ensemble/votingClassifier.ts +++ b/src/ensemble/VotingClassifier.ts @@ -1,7 +1,7 @@ import { Scikit1D, Scikit2D } from '../types' import { tf } from '../shared/globals' import { ClassifierMixin } from '../mixins' -import { LabelEncoder } from '../preprocessing/labelEncoder' +import { LabelEncoder } from '../preprocessing/LabelEncoder' import { fromJson, toJson } from './serializeEnsemble' /* diff --git a/src/ensemble/votingRegressor.test.ts b/src/ensemble/VotingRegressor.test.ts similarity index 87% rename from src/ensemble/votingRegressor.test.ts rename to src/ensemble/VotingRegressor.test.ts index 6421670e..06a69f97 100644 --- a/src/ensemble/votingRegressor.test.ts +++ b/src/ensemble/VotingRegressor.test.ts @@ -1,6 +1,6 @@ -import { makeVotingRegressor, VotingRegressor } from './votingRegressor' -import { DummyRegressor } from '../dummy/dummyRegressor' -import { LinearRegression } from '../linear_model/linearRegression' +import { makeVotingRegressor, VotingRegressor } from './VotingRegressor' +import { DummyRegressor } from '../dummy/DummyRegressor' +import { LinearRegression } from '../linear_model/LinearRegression' describe('VotingRegressor', function () { it('Use VotingRegressor on simple example ', async function () { diff --git a/src/ensemble/votingRegressor.ts b/src/ensemble/VotingRegressor.ts similarity index 100% rename from src/ensemble/votingRegressor.ts rename to src/ensemble/VotingRegressor.ts diff --git a/src/ensemble/serializeEnsemble.ts b/src/ensemble/serializeEnsemble.ts index b148ed97..245c89df 100644 --- a/src/ensemble/serializeEnsemble.ts +++ b/src/ensemble/serializeEnsemble.ts @@ -1,34 +1,34 @@ -import { DummyClassifier } from '../dummy/dummyClassifier' -import { DummyRegressor } from '../dummy/dummyRegressor' -import { LogisticRegression } from '../linear_model/logisticRegression' -import { RidgeRegression } from '../linear_model/ridgeRegression' -import { LinearRegression } from '../linear_model/linearRegression' -import { LassoRegression } from '../linear_model/lassoRegression' -import { ElasticNet } from '../linear_model/elasticNet' -import { LabelEncoder } from '../preprocessing/labelEncoder' -import { SimpleImputer } from '../impute/simpleImputer' +import { DummyClassifier } from '../dummy/DummyClassifier' +import { DummyRegressor } from '../dummy/DummyRegressor' +import { LogisticRegression } from '../linear_model/LogisticRegression' +import { RidgeRegression } from '../linear_model/RidgeRegression' +import { LinearRegression } from '../linear_model/LinearRegression' +import { LassoRegression } from '../linear_model/LassoRegression' +import { ElasticNet } from '../linear_model/ElasticNet' +import { LabelEncoder } from '../preprocessing/LabelEncoder' +import { SimpleImputer } from '../impute/SimpleImputer' import { tf } from '../shared/globals' -import { MinMaxScaler } from '../preprocessing/minMaxScaler' +import { MinMaxScaler } from '../preprocessing/MinMaxScaler' function getEstimator(name: string, serialJson: string) { switch (name) { - case 'dummyclassifier': + case 'DummyClassifier': return new DummyClassifier().fromJson(serialJson) - case 'dummyregressor': + case 'DummyRegressor': return new DummyRegressor().fromJson(serialJson) - case 'logisticregression': + case 'LogisticRegression': return new LogisticRegression().fromJson(serialJson) - case 'ridgeregression': + case 'RidgeRegression': return new RidgeRegression().fromJson(serialJson) - case 'linearregression': + case 'LinearRegression': return new LinearRegression().fromJson(serialJson) - case 'lassoregression': + case 'LassoRegression': return new LassoRegression().fromJson(serialJson) - case 'elasticnet': + case 'ElasticNet': return new ElasticNet().fromJson(serialJson) - case 'simpleimputer': + case 'SimpleImputer': return new SimpleImputer().fromJson(serialJson) - case 'minmaxscaler': + case 'MinMaxScaler': return new MinMaxScaler().fromJson(serialJson) default: throw new Error(`${name} estimator not supported`) diff --git a/src/impute/simpleImputer.test.ts b/src/impute/SimpleImputer.test.ts similarity index 98% rename from src/impute/simpleImputer.test.ts rename to src/impute/SimpleImputer.test.ts index 9a861d2f..fb58af50 100644 --- a/src/impute/simpleImputer.test.ts +++ b/src/impute/SimpleImputer.test.ts @@ -1,5 +1,5 @@ import { tf } from '../shared/globals' -import { SimpleImputer } from './simpleImputer' +import { SimpleImputer } from './SimpleImputer' describe('SimpleImputer', function () { it('Imputes with "constant" strategy 2D one column. In this strategy, we give the fill value', function () { @@ -131,7 +131,7 @@ describe('SimpleImputer', function () { ] const expected = { - name: 'simpleimputer', + name: 'SimpleImputer', missingValues: null, strategy: 'mostFrequent', statistics: { diff --git a/src/impute/simpleImputer.ts b/src/impute/SimpleImputer.ts similarity index 99% rename from src/impute/simpleImputer.ts rename to src/impute/SimpleImputer.ts index cf5de91d..722591c7 100644 --- a/src/impute/simpleImputer.ts +++ b/src/impute/SimpleImputer.ts @@ -66,7 +66,7 @@ export class SimpleImputer extends TransformerMixin { statistics: tf.Tensor1D /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'simpleimputer' + name = 'SimpleImputer' constructor({ strategy = 'mean', diff --git a/src/index.test.ts b/src/index.test.ts index bf1e606e..eb1f7291 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,18 +1,18 @@ -import './cluster/kmeans.test' -import './compose/columnTransformer.test' +import './cluster/KMeans.test' +import './compose/ColumnTransformer.test' import './datasets/makeRegression.test' -import './dummy/dummyClassifier.test' -import './dummy/dummyRegressor.test' -import './ensemble/votingClassifier.test' -import './ensemble/votingRegressor.test' -import './impute/simpleImputer.test' -import './linear_model/linearRegression.test' +import './dummy/DummyClassifier.test' +import './dummy/DummyRegressor.test' +import './ensemble/VotingClassifier.test' +import './ensemble/VotingRegressor.test' +import './impute/SimpleImputer.test' +import './linear_model/LinearRegression.test' /* When we figure out why we can't save / load logistic regressions */ // import './linear_model/logisticRegression.test' import './metrics/metrics.test' -// import './model_selection/kFold.test' +// import './model_selection/KFold.test' import './model_selection/trainTestSplit.test' -import './naive_bayes/gaussianNaiveBayes.test' +import './naive_bayes/GaussianNB.test' /* When we figure out how to do expect.extend in karma */ // import './neighbors/bruteNeighborhood.test' // import './neighbors/cappedMaxHeap.test' @@ -20,22 +20,22 @@ import './naive_bayes/gaussianNaiveBayes.test' // import './neighbors/kNeighborsClassifier.test' // import './neighbors/kNeighborsRegressor.test' // import './neighbors/metrics.test' -import './pipeline/pipeline.test' -import './preprocessing/labelEncoder.test' -import './preprocessing/maxAbsScaler.test' -import './preprocessing/minMaxScaler.test' -import './preprocessing/normalizer.test' -import './preprocessing/oneHotEncoder.test' -import './preprocessing/ordinalEncoder.test' -import './preprocessing/robustScaler.test' -import './preprocessing/standardScaler.test' -import './svm/linearSVC.test' -import './svm/linearSVR.test' +import './pipeline/Pipeline.test' +import './preprocessing/LabelEncoder.test' +import './preprocessing/MaxAbsScaler.test' +import './preprocessing/MinMaxScaler.test' +import './preprocessing/Normalizer.test' +import './preprocessing/OneHotEncoder.test' +import './preprocessing/OrdinalEncoder.test' +import './preprocessing/RobustScaler.test' +import './preprocessing/StandardScaler.test' +import './svm/LinearSVC.test' +import './svm/LinearSVR.test' /* When we put back in the SVM code */ // import './svm/SVC.test' // import './svm/SVR.test' -import './tree/criterion.test' -// import './tree/decisiontree.test' -import './tree/splitter.test' +import './tree/Criterion.test' +// import './tree/DecisionTree.test' +import './tree/Splitter.test' /* When we use the expect.extend stuff */ // import './jestTensorMatchers.test' diff --git a/src/index.ts b/src/index.ts index 69172976..6ab8fb07 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,74 +12,74 @@ * limitations under the License. * ========================================================================== */ -export { KNeighborsRegressor } from './neighbors/kNeighborsRegressor' +export { KNeighborsRegressor } from './neighbors/KNeighborsRegressor' export { LinearRegression, LinearRegressionParams -} from './linear_model/linearRegression' -export { LassoRegression, LassoParams } from './linear_model/lassoRegression' +} from './linear_model/LinearRegression' +export { LassoRegression, LassoParams } from './linear_model/LassoRegression' export { RidgeRegression, RidgeRegressionParams -} from './linear_model/ridgeRegression' -export { ElasticNet, ElasticNetParams } from './linear_model/elasticNet' +} from './linear_model/RidgeRegression' +export { ElasticNet, ElasticNetParams } from './linear_model/ElasticNet' export { LogisticRegression, LogisticRegressionParams -} from './linear_model/logisticRegression' +} from './linear_model/LogisticRegression' export * as metrics from './metrics/metrics' -export { DummyRegressor, DummyRegressorParams } from './dummy/dummyRegressor' +export { DummyRegressor, DummyRegressorParams } from './dummy/DummyRegressor' export { DummyClassifier, DummyClassifierParams -} from './dummy/dummyClassifier' -export { MinMaxScaler, MinMaxScalerParams } from './preprocessing/minMaxScaler' +} from './dummy/DummyClassifier' +export { MinMaxScaler, MinMaxScalerParams } from './preprocessing/MinMaxScaler' export { StandardScaler, StandardScalerParams -} from './preprocessing/standardScaler' -export { MaxAbsScaler } from './preprocessing/maxAbsScaler' -export { SimpleImputer, SimpleImputerParams } from './impute/simpleImputer' +} from './preprocessing/StandardScaler' +export { MaxAbsScaler } from './preprocessing/MaxAbsScaler' +export { SimpleImputer, SimpleImputerParams } from './impute/SimpleImputer' export { OneHotEncoder, OneHotEncoderParams -} from './preprocessing/oneHotEncoder' -export { LabelEncoder } from './preprocessing/labelEncoder' +} from './preprocessing/OneHotEncoder' +export { LabelEncoder } from './preprocessing/LabelEncoder' export { OrdinalEncoder, OrdinalEncoderParams -} from './preprocessing/ordinalEncoder' -export { Normalizer, NormalizerParams } from './preprocessing/normalizer' -export { Pipeline, PipelineParams, makePipeline } from './pipeline/pipeline' +} from './preprocessing/OrdinalEncoder' +export { Normalizer, NormalizerParams } from './preprocessing/Normalizer' +export { Pipeline, PipelineParams, makePipeline } from './pipeline/Pipeline' export { ColumnTransformer, ColumnTransformerParams -} from './compose/columnTransformer' -export { RobustScaler, RobustScalerParams } from './preprocessing/robustScaler' -export { KMeans, KMeansParams } from './cluster/kmeans' +} from './compose/ColumnTransformer' +export { RobustScaler, RobustScalerParams } from './preprocessing/RobustScaler' +export { KMeans, KMeansParams } from './cluster/KMeans' export { Scikit1D, Scikit2D, ScikitVecOrMatrix } from './types' export { dataUrls } from './datasets/datasets' export { makeVotingRegressor, VotingRegressor, VotingRegressorParams -} from './ensemble/votingRegressor' +} from './ensemble/VotingRegressor' export { makeVotingClassifier, VotingClassifier, VotingClassifierParams -} from './ensemble/votingClassifier' -export { LinearSVC, LinearSVCParams } from './svm/linearSVC' -export { LinearSVR, LinearSVRParams } from './svm/linearSVR' +} from './ensemble/VotingClassifier' +export { LinearSVC, LinearSVCParams } from './svm/LinearSVC' +export { LinearSVR, LinearSVRParams } from './svm/LinearSVR' // Comment these out until our libsvm version doesn't ship with fs / path subdependencies // They were stopping the browser build from being built // export { SVR, SVRParams } from './svm/SVR' // export { SVC, SVCParams } from './svm/SVC' -export { GaussianNB } from './naive_bayes/gaussianNaiveBayes' +export { GaussianNB } from './naive_bayes/GaussianNB' export { DecisionTreeClassifier, DecisionTreeClassifierParams, DecisionTreeRegressor, DecisionTreeRegressorParams -} from './tree/decisiontree' +} from './tree/DecisionTree' diff --git a/src/linear_model/elasticNet.ts b/src/linear_model/ElasticNet.ts similarity index 96% rename from src/linear_model/elasticNet.ts rename to src/linear_model/ElasticNet.ts index 53cbae7e..a35f35b6 100644 --- a/src/linear_model/elasticNet.ts +++ b/src/linear_model/ElasticNet.ts @@ -13,7 +13,7 @@ * ========================================================================== */ -import { SGDRegressor } from './sgdRegressor' +import { SGDRegressor } from './SgdRegressor' import { tf } from '../shared/globals' // First pass at a ElasticNet implementation using gradient descent @@ -34,7 +34,7 @@ export interface ElasticNetParams { */ export class ElasticNet extends SGDRegressor { /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'elasticnet' + name = 'ElasticNet' constructor({ alpha = 1, diff --git a/src/linear_model/lassoRegression.ts b/src/linear_model/LassoRegression.ts similarity index 96% rename from src/linear_model/lassoRegression.ts rename to src/linear_model/LassoRegression.ts index a6ccba5b..32f1438c 100644 --- a/src/linear_model/lassoRegression.ts +++ b/src/linear_model/LassoRegression.ts @@ -13,7 +13,7 @@ * ========================================================================== */ -import { SGDRegressor } from './sgdRegressor' +import { SGDRegressor } from './SgdRegressor' import { tf } from '../shared/globals' // First pass at a LassoRegression implementation using gradient descent @@ -29,7 +29,7 @@ export interface LassoParams { /** Linear Model trained with L1 prior as regularizer (aka the Lasso). */ export class LassoRegression extends SGDRegressor { /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'lassoregression' + name = 'LassoRegression' constructor({ fitIntercept = true, alpha = 1.0 }: LassoParams = {}) { super({ diff --git a/src/linear_model/linearRegression.test.ts b/src/linear_model/LinearRegression.test.ts similarity index 98% rename from src/linear_model/linearRegression.test.ts rename to src/linear_model/LinearRegression.test.ts index 14787922..a4d67295 100644 --- a/src/linear_model/linearRegression.test.ts +++ b/src/linear_model/LinearRegression.test.ts @@ -1,4 +1,4 @@ -import { LinearRegression } from './linearRegression' +import { LinearRegression } from './LinearRegression' import { tensorEqual } from '../utils' import { tf } from '../shared/globals' diff --git a/src/linear_model/linearRegression.ts b/src/linear_model/LinearRegression.ts similarity index 97% rename from src/linear_model/linearRegression.ts rename to src/linear_model/LinearRegression.ts index 184a4183..3c4e099c 100644 --- a/src/linear_model/linearRegression.ts +++ b/src/linear_model/LinearRegression.ts @@ -13,7 +13,7 @@ * ========================================================================== */ -import { SGDRegressor } from './sgdRegressor' +import { SGDRegressor } from './SgdRegressor' import { tf } from '../shared/globals' /** @@ -67,7 +67,7 @@ Next steps: */ export class LinearRegression extends SGDRegressor { /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'linearregression' + name = 'LinearRegression' constructor({ fitIntercept = true }: LinearRegressionParams = {}) { super({ diff --git a/src/linear_model/logisticRegression.test.ts b/src/linear_model/LogisticRegression.test.ts similarity index 98% rename from src/linear_model/logisticRegression.test.ts rename to src/linear_model/LogisticRegression.test.ts index ba8ca88a..c00db0fa 100644 --- a/src/linear_model/logisticRegression.test.ts +++ b/src/linear_model/LogisticRegression.test.ts @@ -1,4 +1,4 @@ -import { LogisticRegression } from './logisticRegression' +import { LogisticRegression } from './LogisticRegression' import { tf } from '../shared/globals' describe('LogisticRegression', function () { diff --git a/src/linear_model/logisticRegression.ts b/src/linear_model/LogisticRegression.ts similarity index 97% rename from src/linear_model/logisticRegression.ts rename to src/linear_model/LogisticRegression.ts index b873fb9e..30651225 100644 --- a/src/linear_model/logisticRegression.ts +++ b/src/linear_model/LogisticRegression.ts @@ -13,7 +13,7 @@ // * ========================================================================== // */ -import { SGDClassifier } from './sgdClassifier' +import { SGDClassifier } from './SgdClassifier' import { tf } from '../shared/globals' // First pass at a LogisticRegression implementation using gradient descent @@ -61,7 +61,7 @@ export interface LogisticRegressionParams { */ export class LogisticRegression extends SGDClassifier { /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'logisticregression' + name = 'LogisticRegression' constructor({ penalty = 'l2', diff --git a/src/linear_model/ridgeRegression.ts b/src/linear_model/RidgeRegression.ts similarity index 96% rename from src/linear_model/ridgeRegression.ts rename to src/linear_model/RidgeRegression.ts index 24e9c1b8..1d3cbf72 100644 --- a/src/linear_model/ridgeRegression.ts +++ b/src/linear_model/RidgeRegression.ts @@ -13,7 +13,7 @@ * ========================================================================== */ -import { SGDRegressor } from './sgdRegressor' +import { SGDRegressor } from './SgdRegressor' import { tf } from '../shared/globals' // RidgeRegression implementation using gradient descent @@ -31,7 +31,7 @@ export interface RidgeRegressionParams { /** Linear least squares with l2 regularization. */ export class RidgeRegression extends SGDRegressor { /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'ridgeregression' + name = 'RidgeRegression' constructor({ fitIntercept = true, diff --git a/src/linear_model/sgdClassifier.ts b/src/linear_model/SgdClassifier.ts similarity index 99% rename from src/linear_model/sgdClassifier.ts rename to src/linear_model/SgdClassifier.ts index ac48fe78..b5900a39 100644 --- a/src/linear_model/sgdClassifier.ts +++ b/src/linear_model/SgdClassifier.ts @@ -17,7 +17,7 @@ import { tf } from '../shared/globals' // import { DenseLayerArgs } from '@tensorflow/tfjs-layers/dist/layers/core' import { convertToNumericTensor1D, convertToNumericTensor2D } from '../utils' import { Scikit2D, Scikit1D, OptimizerTypes, LossTypes } from '../types' -import { OneHotEncoder } from '../preprocessing/oneHotEncoder' +import { OneHotEncoder } from '../preprocessing/OneHotEncoder' import { assert } from '../typesUtils' import { ClassifierMixin } from '../mixins' import { fromJson, toJSON } from './modelSerializer' diff --git a/src/linear_model/sgdRegressor.ts b/src/linear_model/SgdRegressor.ts similarity index 100% rename from src/linear_model/sgdRegressor.ts rename to src/linear_model/SgdRegressor.ts diff --git a/src/linear_model/modelSerializer.ts b/src/linear_model/modelSerializer.ts index 703f8328..aac0aeba 100644 --- a/src/linear_model/modelSerializer.ts +++ b/src/linear_model/modelSerializer.ts @@ -1,6 +1,6 @@ import { optimizer, initializer, getLoss } from '../utils' import { tf } from '../shared/globals' -import { OneHotEncoder } from '../preprocessing/oneHotEncoder' +import { OneHotEncoder } from '../preprocessing/OneHotEncoder' function getModelWeight( model: tf.Sequential diff --git a/src/model_selection/crossValidator.ts b/src/model_selection/CrossValidator.ts similarity index 100% rename from src/model_selection/crossValidator.ts rename to src/model_selection/CrossValidator.ts diff --git a/src/model_selection/kFold.test.ts b/src/model_selection/KFold.test.ts similarity index 99% rename from src/model_selection/kFold.test.ts rename to src/model_selection/KFold.test.ts index 6f6a96c8..bb18ef14 100644 --- a/src/model_selection/kFold.test.ts +++ b/src/model_selection/KFold.test.ts @@ -14,7 +14,7 @@ */ import * as fc from 'fast-check' -import { KFold } from './kFold' +import { KFold } from './KFold' import { alea } from 'seedrandom' import '../jestTensorMatchers' import { tf } from '../shared/globals' diff --git a/src/model_selection/kFold.ts b/src/model_selection/KFold.ts similarity index 98% rename from src/model_selection/kFold.ts rename to src/model_selection/KFold.ts index 7423feec..cf67abbb 100644 --- a/src/model_selection/kFold.ts +++ b/src/model_selection/KFold.ts @@ -14,7 +14,7 @@ */ import { assert } from '../typesUtils' -import { CrossValidator } from './crossValidator' +import { CrossValidator } from './CrossValidator' import * as randUtils from '../randUtils' import { Scikit1D, Scikit2D } from '../types' import { getLength } from '../utils' @@ -81,7 +81,7 @@ export class KFold implements CrossValidator { nSplits: number shuffle: boolean randomState?: number - + name: string constructor({ nSplits = 5, shuffle = false, @@ -95,6 +95,7 @@ export class KFold implements CrossValidator { this.nSplits = nSplits this.shuffle = Boolean(shuffle) this.randomState = randomState + this.name = 'KFold' } public getNumSplits(): number { diff --git a/src/model_selection/crossValScore.ts b/src/model_selection/crossValScore.ts index bc4c1498..7d0b551c 100644 --- a/src/model_selection/crossValScore.ts +++ b/src/model_selection/crossValScore.ts @@ -14,8 +14,8 @@ */ import { assert } from '../typesUtils' -import { CrossValidator } from './crossValidator' -import { KFold } from './kFold' +import { CrossValidator } from './CrossValidator' +import { KFold } from './KFold' import { Scikit1D, Scikit2D } from '../types' import { isScikit1D } from '../typesUtils' import { convertToTensor1D, convertToTensor2D } from '../utils' diff --git a/src/naive_bayes/baseNaiveBayes.ts b/src/naive_bayes/BaseNaiveBayes.ts similarity index 100% rename from src/naive_bayes/baseNaiveBayes.ts rename to src/naive_bayes/BaseNaiveBayes.ts diff --git a/src/naive_bayes/gaussianNaiveBayes.test.ts b/src/naive_bayes/GaussianNB.test.ts similarity index 98% rename from src/naive_bayes/gaussianNaiveBayes.test.ts rename to src/naive_bayes/GaussianNB.test.ts index 1936e59d..627018e8 100644 --- a/src/naive_bayes/gaussianNaiveBayes.test.ts +++ b/src/naive_bayes/GaussianNB.test.ts @@ -12,7 +12,7 @@ * limitations under the License. * ========================================================================== */ -import { GaussianNB } from './gaussianNaiveBayes' +import { GaussianNB } from './GaussianNB' describe('GaussianNB', function () { it('without priors', async () => { diff --git a/src/naive_bayes/gaussianNaiveBayes.ts b/src/naive_bayes/GaussianNB.ts similarity index 95% rename from src/naive_bayes/gaussianNaiveBayes.ts rename to src/naive_bayes/GaussianNB.ts index 421c3af7..6801b841 100644 --- a/src/naive_bayes/gaussianNaiveBayes.ts +++ b/src/naive_bayes/GaussianNB.ts @@ -13,7 +13,7 @@ * ========================================================================== */ import { tf } from '../shared/globals' -import { BaseNaiveBayes } from './baseNaiveBayes' +import { BaseNaiveBayes } from './BaseNaiveBayes' /** * Gaussian Naive Bayes classifier @@ -45,6 +45,7 @@ import { BaseNaiveBayes } from './baseNaiveBayes' * */ export class GaussianNB extends BaseNaiveBayes { + name = 'GaussianNB' protected kernel( features: tf.Tensor2D, mean: tf.Tensor1D, diff --git a/src/neighbors/bruteNeighborhood.test.ts b/src/neighbors/BruteNeighborhood.test.ts similarity index 93% rename from src/neighbors/bruteNeighborhood.test.ts rename to src/neighbors/BruteNeighborhood.test.ts index 0bf4f787..b263ff51 100644 --- a/src/neighbors/bruteNeighborhood.test.ts +++ b/src/neighbors/BruteNeighborhood.test.ts @@ -14,7 +14,7 @@ */ import { neighborhoodGenericTests } from './neighborhoodGenericTests' -import { BruteNeighborhood } from './bruteNeighborhood' +import { BruteNeighborhood } from './BruteNeighborhood' neighborhoodGenericTests( 'BruteNeighborhood', diff --git a/src/neighbors/bruteNeighborhood.ts b/src/neighbors/BruteNeighborhood.ts similarity index 95% rename from src/neighbors/bruteNeighborhood.ts rename to src/neighbors/BruteNeighborhood.ts index c0a39655..720d7a1d 100644 --- a/src/neighbors/bruteNeighborhood.ts +++ b/src/neighbors/BruteNeighborhood.ts @@ -13,8 +13,8 @@ * ========================================================================== */ -import { Neighborhood, NeighborhoodParams } from './neighborhood' -import { Metric } from './metrics' +import { Neighborhood, NeighborhoodParams } from './Neighborhood' +import { Metric } from './Metric' import { tf } from '../shared/globals' import { assert } from '../typesUtils' diff --git a/src/neighbors/cappedMaxHeap.test.ts b/src/neighbors/CappedMaxHeap.test.ts similarity index 97% rename from src/neighbors/cappedMaxHeap.test.ts rename to src/neighbors/CappedMaxHeap.test.ts index 64956345..181d8ea9 100644 --- a/src/neighbors/cappedMaxHeap.test.ts +++ b/src/neighbors/CappedMaxHeap.test.ts @@ -15,7 +15,7 @@ import * as fc from 'fast-check' -import { CappedMaxHeap } from './cappedMaxHeap' +import { CappedMaxHeap } from './CappedMaxHeap' describe('CappedMaxHeap', () => { const anyFloat = () => diff --git a/src/neighbors/cappedMaxHeap.ts b/src/neighbors/CappedMaxHeap.ts similarity index 100% rename from src/neighbors/cappedMaxHeap.ts rename to src/neighbors/CappedMaxHeap.ts diff --git a/src/neighbors/kNeighborsBase.ts b/src/neighbors/KNeighborsBase.ts similarity index 96% rename from src/neighbors/kNeighborsBase.ts rename to src/neighbors/KNeighborsBase.ts index af80ed9a..3b4dd715 100644 --- a/src/neighbors/kNeighborsBase.ts +++ b/src/neighbors/KNeighborsBase.ts @@ -13,14 +13,14 @@ * ========================================================================== */ -import { Neighborhood, NeighborhoodParams } from './neighborhood' -import { BruteNeighborhood } from './bruteNeighborhood' -import { minkowskiMetric } from './metrics' +import { Neighborhood, NeighborhoodParams } from './Neighborhood' +import { BruteNeighborhood } from './BruteNeighborhood' +import { minkowskiMetric } from './Metric' import { Scikit1D, Scikit2D } from '../types' import { convertToNumericTensor1D, convertToNumericTensor2D } from '../utils' import { assert } from '../typesUtils' import { tf } from '../shared/globals' -import { KdTree } from './kdTree' +import { KdTree } from './KdTree' import Serialize from '../serialize' const WEIGHTS_FUNCTIONS = { diff --git a/src/neighbors/kNeighborsClassifier.test.ts b/src/neighbors/KNeighborsClassifier.test.ts similarity index 97% rename from src/neighbors/kNeighborsClassifier.test.ts rename to src/neighbors/KNeighborsClassifier.test.ts index 0226bf88..559a72df 100644 --- a/src/neighbors/kNeighborsClassifier.test.ts +++ b/src/neighbors/KNeighborsClassifier.test.ts @@ -13,11 +13,11 @@ * ========================================================================== */ -import { KNeighborsClassifier } from './kNeighborsClassifier' -import { KNeighborsParams } from './kNeighborsBase' +import { KNeighborsClassifier } from './KNeighborsClassifier' +import { KNeighborsParams } from './KNeighborsBase' import { dataUrls } from '../datasets/datasets' import { crossValScore } from '../model_selection/crossValScore' -import { KFold } from '../model_selection/kFold' +import { KFold } from '../model_selection/KFold' import { arrayEqual } from '../utils' import '../jestTensorMatchers' import * as dfd from 'danfojs-node' diff --git a/src/neighbors/kNeighborsClassifier.ts b/src/neighbors/KNeighborsClassifier.ts similarity index 97% rename from src/neighbors/kNeighborsClassifier.ts rename to src/neighbors/KNeighborsClassifier.ts index 534008ad..cc38d9a3 100644 --- a/src/neighbors/kNeighborsClassifier.ts +++ b/src/neighbors/KNeighborsClassifier.ts @@ -14,7 +14,7 @@ */ import { Scikit1D, Scikit2D } from '../types' -import { KNeighborsBase } from './kNeighborsBase' +import { KNeighborsBase } from './KNeighborsBase' import { convertToNumericTensor2D, convertToTensor1D } from '../utils' import { polyfillUnique } from '../tfUtils' import { accuracy } from '../model_selection/scorers' @@ -44,6 +44,7 @@ export class KNeighborsClassifier extends KNeighborsBase { score = accuracy + name = 'KNeighborsClassifier' /** * Applies this mdodel to predict the class probabilities of each given sample. * diff --git a/src/neighbors/kNeighborsRegressor.test.ts b/src/neighbors/KNeighborsRegressor.test.ts similarity index 96% rename from src/neighbors/kNeighborsRegressor.test.ts rename to src/neighbors/KNeighborsRegressor.test.ts index 58dd53fa..50c5c418 100644 --- a/src/neighbors/kNeighborsRegressor.test.ts +++ b/src/neighbors/KNeighborsRegressor.test.ts @@ -13,12 +13,12 @@ * ========================================================================== */ -import { KNeighborsRegressor } from './kNeighborsRegressor' -import { KNeighborsParams } from './kNeighborsBase' +import { KNeighborsRegressor } from './KNeighborsRegressor' +import { KNeighborsParams } from './KNeighborsBase' import { dataUrls } from '../datasets/datasets' import { arrayEqual } from '../utils' import { crossValScore } from '../model_selection/crossValScore' -import { KFold } from '../model_selection/kFold' +import { KFold } from '../model_selection/KFold' import { negMeanSquaredError } from '../model_selection/scorers' import '../jestTensorMatchers' import * as dfd from 'danfojs-node' diff --git a/src/neighbors/kNeighborsRegressor.ts b/src/neighbors/KNeighborsRegressor.ts similarity index 96% rename from src/neighbors/kNeighborsRegressor.ts rename to src/neighbors/KNeighborsRegressor.ts index 0f955982..8bda66f7 100644 --- a/src/neighbors/kNeighborsRegressor.ts +++ b/src/neighbors/KNeighborsRegressor.ts @@ -14,7 +14,7 @@ */ import { Scikit2D } from '../types' -import { KNeighborsBase } from '../neighbors/kNeighborsBase' +import { KNeighborsBase } from './KNeighborsBase' import { convertToNumericTensor2D } from '../utils' import { tf } from '../shared/globals' @@ -45,6 +45,7 @@ export class KNeighborsRegressor extends KNeighborsBase { * @param y The predicted targets `y` where `y[i]` is the prediction * for sample `X[i,:]` */ + name = 'KNeighborsRegressor' public predict(X: Scikit2D) { const { neighborhood, y, nNeighbors, weightsFn } = this._getFitParams() diff --git a/src/neighbors/kdTree.test.ts b/src/neighbors/KdTree.test.ts similarity index 95% rename from src/neighbors/kdTree.test.ts rename to src/neighbors/KdTree.test.ts index 3f452ee7..87736ed3 100644 --- a/src/neighbors/kdTree.test.ts +++ b/src/neighbors/KdTree.test.ts @@ -14,6 +14,6 @@ */ import { neighborhoodGenericTests } from './neighborhoodGenericTests' -import { KdTree } from './kdTree' +import { KdTree } from './KdTree' neighborhoodGenericTests('KdTree', KdTree.build) diff --git a/src/neighbors/kdTree.ts b/src/neighbors/KdTree.ts similarity index 98% rename from src/neighbors/kdTree.ts rename to src/neighbors/KdTree.ts index 3a4e15e6..9a8750d5 100644 --- a/src/neighbors/kdTree.ts +++ b/src/neighbors/KdTree.ts @@ -15,10 +15,10 @@ import { assert } from '../typesUtils' import { tf } from '../shared/globals' -import { Neighborhood, NeighborhoodParams } from './neighborhood' +import { Neighborhood, NeighborhoodParams } from './Neighborhood' import * as randUtils from '../randUtils' import { alea } from 'seedrandom' -import { CappedMaxHeap } from './cappedMaxHeap' +import { CappedMaxHeap } from './CappedMaxHeap' const child = (parent: number) => (parent << 1) + 1 const parent = (child: number) => (child - 1) >> 1 diff --git a/src/neighbors/metrics.test.ts b/src/neighbors/Metric.test.ts similarity index 99% rename from src/neighbors/metrics.test.ts rename to src/neighbors/Metric.test.ts index a754028f..c05c5125 100644 --- a/src/neighbors/metrics.test.ts +++ b/src/neighbors/Metric.test.ts @@ -15,7 +15,7 @@ import * as fc from 'fast-check' -import { Metric, minkowskiMetric } from './metrics' +import { Metric, minkowskiMetric } from './Metric' const NDIMS = Object.freeze([1, 2, 7]) diff --git a/src/neighbors/metrics.ts b/src/neighbors/Metric.ts similarity index 100% rename from src/neighbors/metrics.ts rename to src/neighbors/Metric.ts diff --git a/src/neighbors/neighborhood.ts b/src/neighbors/Neighborhood.ts similarity index 98% rename from src/neighbors/neighborhood.ts rename to src/neighbors/Neighborhood.ts index 6c98dca3..266822f2 100644 --- a/src/neighbors/neighborhood.ts +++ b/src/neighbors/Neighborhood.ts @@ -14,7 +14,7 @@ */ import { tf } from '../shared/globals' -import { Metric } from './metrics' +import { Metric } from './Metric' /** * Default constructor parameters for {@link Neighborhood} instances. diff --git a/src/neighbors/neighborhoodGenericTests.ts b/src/neighbors/neighborhoodGenericTests.ts index b3e9f6c0..ce335682 100644 --- a/src/neighbors/neighborhoodGenericTests.ts +++ b/src/neighbors/neighborhoodGenericTests.ts @@ -16,9 +16,9 @@ import * as fc from 'fast-check' import { tf } from '../shared/globals' import { alea } from 'seedrandom' -import { Neighborhood, NeighborhoodParams } from './neighborhood' +import { Neighborhood, NeighborhoodParams } from './Neighborhood' import { lhs, shuffle } from '../randUtils' -import { minkowskiMetric } from './metrics' +import { minkowskiMetric } from './Metric' import { polyfillUnique } from '../tfUtils' import '../jestTensorMatchers' diff --git a/src/pipeline/pipeline.test.ts b/src/pipeline/Pipeline.test.ts similarity index 93% rename from src/pipeline/pipeline.test.ts rename to src/pipeline/Pipeline.test.ts index 5097b750..52ead335 100644 --- a/src/pipeline/pipeline.test.ts +++ b/src/pipeline/Pipeline.test.ts @@ -1,9 +1,9 @@ -import { Pipeline, makePipeline } from './pipeline' +import { Pipeline, makePipeline } from './Pipeline' import { tf } from '../shared/globals' import { tensorEqual } from '../utils' -import { LinearRegression } from '../linear_model/linearRegression' -import { SimpleImputer } from '../impute/simpleImputer' -import { MinMaxScaler } from '../preprocessing/minMaxScaler' +import { LinearRegression } from '../linear_model/LinearRegression' +import { SimpleImputer } from '../impute/SimpleImputer' +import { MinMaxScaler } from '../preprocessing/MinMaxScaler' describe('Pipeline', function () { it('Use a Pipeline (min-max scaler, and linear regression)', async function () { diff --git a/src/pipeline/pipeline.ts b/src/pipeline/Pipeline.ts similarity index 99% rename from src/pipeline/pipeline.ts rename to src/pipeline/Pipeline.ts index 8344949d..6cf5e6c4 100644 --- a/src/pipeline/pipeline.ts +++ b/src/pipeline/Pipeline.ts @@ -48,7 +48,7 @@ export class Pipeline extends Serialize { steps: Array<[string, any]> /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'pipeline' + name = 'Pipeline' constructor({ steps = [] }: PipelineParams = {}) { super() diff --git a/src/preprocessing/labelEncoder.test.ts b/src/preprocessing/LabelEncoder.test.ts similarity index 96% rename from src/preprocessing/labelEncoder.test.ts rename to src/preprocessing/LabelEncoder.test.ts index 0f3d8945..062929c8 100644 --- a/src/preprocessing/labelEncoder.test.ts +++ b/src/preprocessing/LabelEncoder.test.ts @@ -1,4 +1,4 @@ -import { LabelEncoder } from './labelEncoder' +import { LabelEncoder } from './LabelEncoder' import * as dfd from 'danfojs-node' describe('LabelEncoder', function () { diff --git a/src/preprocessing/labelEncoder.ts b/src/preprocessing/LabelEncoder.ts similarity index 99% rename from src/preprocessing/labelEncoder.ts rename to src/preprocessing/LabelEncoder.ts index 94278599..9067e707 100644 --- a/src/preprocessing/labelEncoder.ts +++ b/src/preprocessing/LabelEncoder.ts @@ -41,7 +41,7 @@ export class LabelEncoder extends Serialize { classes: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'labelencoder' + name = 'LabelEncoder' constructor() { super() diff --git a/src/preprocessing/maxAbsScaler.test.ts b/src/preprocessing/MaxAbsScaler.test.ts similarity index 99% rename from src/preprocessing/maxAbsScaler.test.ts rename to src/preprocessing/MaxAbsScaler.test.ts index c653d115..b69f584a 100644 --- a/src/preprocessing/maxAbsScaler.test.ts +++ b/src/preprocessing/MaxAbsScaler.test.ts @@ -1,4 +1,4 @@ -import { MaxAbsScaler } from './maxAbsScaler' +import { MaxAbsScaler } from './MaxAbsScaler' import * as dfd from 'danfojs-node' import { tf } from '../shared/globals' import { arrayEqual } from '../utils' diff --git a/src/preprocessing/maxAbsScaler.ts b/src/preprocessing/MaxAbsScaler.ts similarity index 99% rename from src/preprocessing/maxAbsScaler.ts rename to src/preprocessing/MaxAbsScaler.ts index f2acccde..a0c7a818 100644 --- a/src/preprocessing/maxAbsScaler.ts +++ b/src/preprocessing/MaxAbsScaler.ts @@ -67,7 +67,7 @@ export class MaxAbsScaler extends TransformerMixin { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'maxabsscaler' + name = 'MaxAbsScaler' constructor() { super() diff --git a/src/preprocessing/minMaxScaler.test.ts b/src/preprocessing/MinMaxScaler.test.ts similarity index 99% rename from src/preprocessing/minMaxScaler.test.ts rename to src/preprocessing/MinMaxScaler.test.ts index cb4def7e..7b15cc47 100644 --- a/src/preprocessing/minMaxScaler.test.ts +++ b/src/preprocessing/MinMaxScaler.test.ts @@ -1,4 +1,4 @@ -import { MinMaxScaler } from './minMaxScaler' +import { MinMaxScaler } from './MinMaxScaler' import * as dfd from 'danfojs-node' import { isDataFrameInterface, isSeriesInterface } from '../typesUtils' import { ScikitVecOrMatrix } from '../types' diff --git a/src/preprocessing/minMaxScaler.ts b/src/preprocessing/MinMaxScaler.ts similarity index 99% rename from src/preprocessing/minMaxScaler.ts rename to src/preprocessing/MinMaxScaler.ts index a35a5ebb..fe37e04d 100644 --- a/src/preprocessing/minMaxScaler.ts +++ b/src/preprocessing/MinMaxScaler.ts @@ -83,7 +83,7 @@ export class MinMaxScaler extends TransformerMixin implements Transformer { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'minmaxscaler' + name = 'MinMaxScaler' constructor({ featureRange = [0, 1] }: MinMaxScalerParams = {}) { super() diff --git a/src/preprocessing/normalizer.test.ts b/src/preprocessing/Normalizer.test.ts similarity index 97% rename from src/preprocessing/normalizer.test.ts rename to src/preprocessing/Normalizer.test.ts index e9672987..65d20877 100644 --- a/src/preprocessing/normalizer.test.ts +++ b/src/preprocessing/Normalizer.test.ts @@ -1,4 +1,4 @@ -import { Normalizer } from './normalizer' +import { Normalizer } from './Normalizer' import * as dfd from 'danfojs-node' import { arrayEqual } from '../utils' diff --git a/src/preprocessing/normalizer.ts b/src/preprocessing/Normalizer.ts similarity index 99% rename from src/preprocessing/normalizer.ts rename to src/preprocessing/Normalizer.ts index 954fd678..e02cc70a 100644 --- a/src/preprocessing/normalizer.ts +++ b/src/preprocessing/Normalizer.ts @@ -65,7 +65,7 @@ export class Normalizer extends TransformerMixin { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'normalizer' + name = 'Normalizer' constructor({ norm = 'l2' }: NormalizerParams = {}) { super() diff --git a/src/preprocessing/oneHotEncoder.test.ts b/src/preprocessing/OneHotEncoder.test.ts similarity index 98% rename from src/preprocessing/oneHotEncoder.test.ts rename to src/preprocessing/OneHotEncoder.test.ts index fe3511e8..35100413 100644 --- a/src/preprocessing/oneHotEncoder.test.ts +++ b/src/preprocessing/OneHotEncoder.test.ts @@ -1,5 +1,5 @@ import { tf } from '../shared/globals' -import { OneHotEncoder } from './oneHotEncoder' +import { OneHotEncoder } from './OneHotEncoder' import { arrayTo2DColumn } from '../utils' describe('OneHotEncoder', function () { diff --git a/src/preprocessing/oneHotEncoder.ts b/src/preprocessing/OneHotEncoder.ts similarity index 99% rename from src/preprocessing/oneHotEncoder.ts rename to src/preprocessing/OneHotEncoder.ts index 7c5f09d7..ea5f4f93 100644 --- a/src/preprocessing/oneHotEncoder.ts +++ b/src/preprocessing/OneHotEncoder.ts @@ -98,7 +98,7 @@ export class OneHotEncoder extends TransformerMixin { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'onehotencoder' + name = 'OneHotEncoder' constructor({ categories = 'auto', diff --git a/src/preprocessing/ordinalEncoder.test.ts b/src/preprocessing/OrdinalEncoder.test.ts similarity index 97% rename from src/preprocessing/ordinalEncoder.test.ts rename to src/preprocessing/OrdinalEncoder.test.ts index e28ee00f..57666262 100644 --- a/src/preprocessing/ordinalEncoder.test.ts +++ b/src/preprocessing/OrdinalEncoder.test.ts @@ -1,4 +1,4 @@ -import { OrdinalEncoder } from './ordinalEncoder' +import { OrdinalEncoder } from './OrdinalEncoder' import { arrayTo2DColumn } from '../utils' describe('OrdinalEncoder', function () { diff --git a/src/preprocessing/ordinalEncoder.ts b/src/preprocessing/OrdinalEncoder.ts similarity index 99% rename from src/preprocessing/ordinalEncoder.ts rename to src/preprocessing/OrdinalEncoder.ts index e03403c9..4eb78752 100644 --- a/src/preprocessing/ordinalEncoder.ts +++ b/src/preprocessing/OrdinalEncoder.ts @@ -89,7 +89,7 @@ export class OrdinalEncoder extends TransformerMixin { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'ordinalencoder' + name = 'OrdinalEncoder' constructor({ categories = 'auto', diff --git a/src/preprocessing/robustScaler.test.ts b/src/preprocessing/RobustScaler.test.ts similarity index 97% rename from src/preprocessing/robustScaler.test.ts rename to src/preprocessing/RobustScaler.test.ts index 2a25da53..3a31475e 100644 --- a/src/preprocessing/robustScaler.test.ts +++ b/src/preprocessing/RobustScaler.test.ts @@ -1,4 +1,4 @@ -import { RobustScaler } from './robustScaler' +import { RobustScaler } from './RobustScaler' import * as dfd from 'danfojs-node' import { arrayEqual } from '../utils' diff --git a/src/preprocessing/robustScaler.ts b/src/preprocessing/RobustScaler.ts similarity index 99% rename from src/preprocessing/robustScaler.ts rename to src/preprocessing/RobustScaler.ts index 4964a488..9a78f129 100644 --- a/src/preprocessing/robustScaler.ts +++ b/src/preprocessing/RobustScaler.ts @@ -107,7 +107,7 @@ export class RobustScaler extends TransformerMixin { withCentering: boolean /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'robustscaler' + name = 'RobustScaler' constructor({ quantileRange = [25.0, 75.0], diff --git a/src/preprocessing/standardScaler.test.ts b/src/preprocessing/StandardScaler.test.ts similarity index 98% rename from src/preprocessing/standardScaler.test.ts rename to src/preprocessing/StandardScaler.test.ts index a66c6ff1..e3830ef7 100644 --- a/src/preprocessing/standardScaler.test.ts +++ b/src/preprocessing/StandardScaler.test.ts @@ -1,4 +1,4 @@ -import { StandardScaler } from './standardScaler' +import { StandardScaler } from './StandardScaler' import * as dfd from 'danfojs-node' describe('StandardScaler', function () { diff --git a/src/preprocessing/standardScaler.ts b/src/preprocessing/StandardScaler.ts similarity index 99% rename from src/preprocessing/standardScaler.ts rename to src/preprocessing/StandardScaler.ts index c763dab7..90cd9dde 100644 --- a/src/preprocessing/standardScaler.ts +++ b/src/preprocessing/StandardScaler.ts @@ -86,7 +86,7 @@ export class StandardScaler extends TransformerMixin { featureNamesIn: Array /** Useful for pipelines and column transformers to have a default name for transforms */ - name = 'standardscaler' + name = 'StandardScaler' constructor({ withMean = true, withStd = true }: StandardScalerParams = {}) { super() diff --git a/src/svm/linearSVC.test.ts b/src/svm/LinearSVC.test.ts similarity index 97% rename from src/svm/linearSVC.test.ts rename to src/svm/LinearSVC.test.ts index 7e41f37f..142a7034 100644 --- a/src/svm/linearSVC.test.ts +++ b/src/svm/LinearSVC.test.ts @@ -1,4 +1,4 @@ -import { LinearSVC } from './linearSVC' +import { LinearSVC } from './LinearSVC' describe('LinearSVC', function () { it('Works on arrays (small example)', async function () { diff --git a/src/svm/linearSVC.ts b/src/svm/LinearSVC.ts similarity index 97% rename from src/svm/linearSVC.ts rename to src/svm/LinearSVC.ts index 7f64be5c..bedd3c64 100644 --- a/src/svm/linearSVC.ts +++ b/src/svm/LinearSVC.ts @@ -13,7 +13,7 @@ // * ========================================================================== // */ -import { SGDClassifier } from '../linear_model/sgdClassifier' +import { SGDClassifier } from '../linear_model/SgdClassifier' import { tf } from '../shared/globals' // First pass at a LinearSVC implementation using gradient descent diff --git a/src/svm/linearSVR.test.ts b/src/svm/LinearSVR.test.ts similarity index 90% rename from src/svm/linearSVR.test.ts rename to src/svm/LinearSVR.test.ts index b0d25001..2e325983 100644 --- a/src/svm/linearSVR.test.ts +++ b/src/svm/LinearSVR.test.ts @@ -1,4 +1,4 @@ -import { LinearSVR } from './linearSVR' +import { LinearSVR } from './LinearSVR' import { tensorEqual } from '../utils' import { tf } from '../shared/globals' diff --git a/src/svm/linearSVR.ts b/src/svm/LinearSVR.ts similarity index 97% rename from src/svm/linearSVR.ts rename to src/svm/LinearSVR.ts index f3daf8b1..f7efe1e0 100644 --- a/src/svm/linearSVR.ts +++ b/src/svm/LinearSVR.ts @@ -13,7 +13,7 @@ // * ========================================================================== // */ -import { SGDRegressor } from '../linear_model/sgdRegressor' +import { SGDRegressor } from '../linear_model/SgdRegressor' import { tf } from '../shared/globals' // First pass at a LinearSVC implementation using gradient descent diff --git a/src/tree/criterion.test.ts b/src/tree/Criterion.test.ts similarity index 99% rename from src/tree/criterion.test.ts rename to src/tree/Criterion.test.ts index 551e18ed..c58617fc 100644 --- a/src/tree/criterion.test.ts +++ b/src/tree/Criterion.test.ts @@ -1,4 +1,4 @@ -import { ClassificationCriterion, giniCoefficient, entropy } from './criterion' +import { ClassificationCriterion, giniCoefficient, entropy } from './Criterion' describe('Criterion', function () { let X = [ diff --git a/src/tree/criterion.ts b/src/tree/Criterion.ts similarity index 100% rename from src/tree/criterion.ts rename to src/tree/Criterion.ts diff --git a/src/tree/decisiontree.test.ts b/src/tree/DecisionTree.test.ts similarity index 99% rename from src/tree/decisiontree.test.ts rename to src/tree/DecisionTree.test.ts index cb500392..7e1a5207 100644 --- a/src/tree/decisiontree.test.ts +++ b/src/tree/DecisionTree.test.ts @@ -1,4 +1,4 @@ -import { DecisionTreeClassifier, DecisionTreeRegressor } from './decisiontree' +import { DecisionTreeClassifier, DecisionTreeRegressor } from './DecisionTree' import { dataUrls } from '../datasets/datasets' import * as dfd from 'danfojs-node' diff --git a/src/tree/decisiontree.ts b/src/tree/DecisionTree.ts similarity index 98% rename from src/tree/decisiontree.ts rename to src/tree/DecisionTree.ts index ca5c67f7..292dca08 100644 --- a/src/tree/decisiontree.ts +++ b/src/tree/DecisionTree.ts @@ -1,13 +1,13 @@ -import { ImpurityMeasure } from './criterion' -import { Splitter } from './splitter' +import { ImpurityMeasure } from './Criterion' +import { Splitter } from './Splitter' import { int } from '../randUtils' import { r2Score, accuracyScore } from '../metrics/metrics' -import { Split, makeDefaultSplit } from './splitter' +import { Split, makeDefaultSplit } from './Splitter' import { assert, isScikit1D, isScikit2D } from '../typesUtils' import { validateX, validateY } from './utils' import { Scikit1D, Scikit2D } from '../types' import { convertScikit2DToArray, convertScikit1DToArray } from '../utils' -import { LabelEncoder } from '../preprocessing/labelEncoder' +import { LabelEncoder } from '../preprocessing/LabelEncoder' import Serialize from '../serialize' /* @@ -396,7 +396,7 @@ export class DecisionTreeClassifier extends DecisionTreeBase { minImpurityDecrease }) this.labelEncoder = new LabelEncoder() - this.name = 'decisionTreeClassifier' + this.name = 'DecisionTreeClassifier' } public fit(X: Scikit2D, y: Scikit1D): DecisionTreeClassifier { assert(isScikit1D(y), 'y value is not a 1D container') @@ -489,7 +489,7 @@ export class DecisionTreeRegressor extends DecisionTreeBase { maxFeatures, minImpurityDecrease }) - this.name = 'decisionTreeRegressor' + this.name = 'DecisionTreeRegressor' } public fit(X: Scikit2D, y: Scikit1D): DecisionTreeRegressor { assert(isScikit1D(y), 'y value is not a 1D container') diff --git a/src/tree/splitter.test.ts b/src/tree/Splitter.test.ts similarity index 98% rename from src/tree/splitter.test.ts rename to src/tree/Splitter.test.ts index feac7fe8..ff7d7a6c 100644 --- a/src/tree/splitter.test.ts +++ b/src/tree/Splitter.test.ts @@ -1,5 +1,5 @@ -import { ImpurityMeasure } from './criterion' -import { Splitter } from './splitter' +import { ImpurityMeasure } from './Criterion' +import { Splitter } from './Splitter' describe('Splitter', function () { let types = ['gini', 'entropy', 'squared_error'] diff --git a/src/tree/splitter.ts b/src/tree/Splitter.ts similarity index 99% rename from src/tree/splitter.ts rename to src/tree/Splitter.ts index 93c331b3..e7fbbb60 100644 --- a/src/tree/splitter.ts +++ b/src/tree/Splitter.ts @@ -2,7 +2,7 @@ import { ClassificationCriterion, RegressionCriterion, ImpurityMeasure -} from './criterion' +} from './Criterion' import { shuffle } from 'lodash' import { int } from '../randUtils' import Serialize from '../serialize' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy