mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
fixed/optimized imports,
fixed headers Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
a48ef20ef2
commit
5d5d6c4c5e
@ -7,10 +7,13 @@
|
|||||||
# current benchmark of optimization: 1.33 times faster
|
# current benchmark of optimization: 1.33 times faster
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "3.0.4"
|
__version__ = "3.0.5"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
3.0.5:
|
||||||
|
- removed extra submodule imports
|
||||||
|
- fixed/optimized header
|
||||||
3.0.4:
|
3.0.4:
|
||||||
- removed -_obj imports
|
- removed -_obj imports
|
||||||
3.0.3:
|
3.0.3:
|
||||||
@ -361,7 +364,6 @@ __all__ = [
|
|||||||
'histo_analysis',
|
'histo_analysis',
|
||||||
'regression',
|
'regression',
|
||||||
'Metric',
|
'Metric',
|
||||||
'kmeans',
|
|
||||||
'pca',
|
'pca',
|
||||||
'decisiontree',
|
'decisiontree',
|
||||||
# all statistics functions left out due to integration in other functions
|
# all statistics functions left out due to integration in other functions
|
||||||
@ -374,21 +376,14 @@ __all__ = [
|
|||||||
import csv
|
import csv
|
||||||
from tra_analysis.metrics import elo as Elo
|
from tra_analysis.metrics import elo as Elo
|
||||||
from tra_analysis.metrics import glicko2 as Glicko2
|
from tra_analysis.metrics import glicko2 as Glicko2
|
||||||
import math
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy
|
import scipy
|
||||||
from scipy import optimize, stats
|
import sklearn, sklearn.cluster
|
||||||
import sklearn
|
|
||||||
from sklearn import preprocessing, pipeline, linear_model, metrics, cluster, decomposition, tree, neighbors, naive_bayes, svm, model_selection, ensemble
|
|
||||||
from tra_analysis.metrics import trueskill as Trueskill
|
from tra_analysis.metrics import trueskill as Trueskill
|
||||||
import warnings
|
|
||||||
|
|
||||||
# import submodules
|
# import submodules
|
||||||
|
|
||||||
from .Array import Array
|
|
||||||
from .ClassificationMetric import ClassificationMetric
|
from .ClassificationMetric import ClassificationMetric
|
||||||
from .RegressionMetric import RegressionMetric
|
|
||||||
from . import SVM
|
|
||||||
|
|
||||||
class error(ValueError):
|
class error(ValueError):
|
||||||
pass
|
pass
|
||||||
@ -599,16 +594,7 @@ def npmin(data):
|
|||||||
def npmax(data):
|
def npmax(data):
|
||||||
|
|
||||||
return np.amax(data)
|
return np.amax(data)
|
||||||
""" need to decide what to do with this function
|
|
||||||
def kmeans(data, n_clusters=8, init="k-means++", n_init=10, max_iter=300, tol=0.0001, precompute_distances="auto", verbose=0, random_state=None, copy_x=True, n_jobs=None, algorithm="auto"):
|
|
||||||
|
|
||||||
kernel = sklearn.cluster.KMeans(n_clusters = n_clusters, init = init, n_init = n_init, max_iter = max_iter, tol = tol, precompute_distances = precompute_distances, verbose = verbose, random_state = random_state, copy_x = copy_x, n_jobs = n_jobs, algorithm = algorithm)
|
|
||||||
kernel.fit(data)
|
|
||||||
predictions = kernel.predict(data)
|
|
||||||
centers = kernel.cluster_centers_
|
|
||||||
|
|
||||||
return centers, predictions
|
|
||||||
"""
|
|
||||||
def pca(data, n_components = None, copy = True, whiten = False, svd_solver = "auto", tol = 0.0, iterated_power = "auto", random_state = None):
|
def pca(data, n_components = None, copy = True, whiten = False, svd_solver = "auto", tol = 0.0, iterated_power = "auto", random_state = None):
|
||||||
|
|
||||||
kernel = sklearn.decomposition.PCA(n_components = n_components, copy = copy, whiten = whiten, svd_solver = svd_solver, tol = tol, iterated_power = iterated_power, random_state = random_state)
|
kernel = sklearn.decomposition.PCA(n_components = n_components, copy = copy, whiten = whiten, svd_solver = svd_solver, tol = tol, iterated_power = iterated_power, random_state = random_state)
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import ClassificationMetric'
|
# this should be imported as a python module using 'from tra_analysis import ClassificationMetric'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.2:
|
||||||
|
- optimized imports
|
||||||
1.0.1:
|
1.0.1:
|
||||||
- fixed __all__
|
- fixed __all__
|
||||||
1.0.0:
|
1.0.0:
|
||||||
@ -22,7 +24,6 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import metrics
|
|
||||||
|
|
||||||
class ClassificationMetric():
|
class ClassificationMetric():
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import CorrelationTest'
|
# this should be imported as a python module using 'from tra_analysis import CorrelationTest'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.2:
|
||||||
|
- optimized imports
|
||||||
1.0.1:
|
1.0.1:
|
||||||
- fixed __all__
|
- fixed __all__
|
||||||
1.0.0:
|
1.0.0:
|
||||||
@ -29,7 +31,6 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import scipy
|
import scipy
|
||||||
from scipy import stats
|
|
||||||
|
|
||||||
def anova_oneway(*args): #expects arrays of samples
|
def anova_oneway(*args): #expects arrays of samples
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import KNN'
|
# this should be imported as a python module using 'from tra_analysis import KNN'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.0"
|
__version__ = "1.0.1"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.1:
|
||||||
|
- optimized imports
|
||||||
1.0.0:
|
1.0.0:
|
||||||
- ported analysis.KNN() here
|
- ported analysis.KNN() here
|
||||||
- removed classness
|
- removed classness
|
||||||
@ -23,7 +25,6 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import model_selection, neighbors
|
|
||||||
from . import ClassificationMetric, RegressionMetric
|
from . import ClassificationMetric, RegressionMetric
|
||||||
|
|
||||||
def knn_classifier(data, labels, n_neighbors = 5, test_size = 0.3, algorithm='auto', leaf_size=30, metric='minkowski', metric_params=None, n_jobs=None, p=2, weights='uniform'): #expects *2d data and 1d labels post-scaling
|
def knn_classifier(data, labels, n_neighbors = 5, test_size = 0.3, algorithm='auto', leaf_size=30, metric='minkowski', metric_params=None, n_jobs=None, p=2, weights='uniform'): #expects *2d data and 1d labels post-scaling
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import NaiveBayes'
|
# this should be imported as a python module using 'from tra_analysis import NaiveBayes'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.0"
|
__version__ = "1.0.1"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.1:
|
||||||
|
- optimized imports
|
||||||
1.0.0:
|
1.0.0:
|
||||||
- ported analysis.NaiveBayes() here
|
- ported analysis.NaiveBayes() here
|
||||||
- removed classness
|
- removed classness
|
||||||
@ -24,8 +26,7 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import model_selection, naive_bayes
|
from . import ClassificationMetric
|
||||||
from . import ClassificationMetric, RegressionMetric
|
|
||||||
|
|
||||||
def gaussian(data, labels, test_size = 0.3, priors = None, var_smoothing = 1e-09):
|
def gaussian(data, labels, test_size = 0.3, priors = None, var_smoothing = 1e-09):
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import RandomForest'
|
# this should be imported as a python module using 'from tra_analysis import RandomForest'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.2:
|
||||||
|
- optimized imports
|
||||||
1.0.1:
|
1.0.1:
|
||||||
- fixed __all__
|
- fixed __all__
|
||||||
1.0.0:
|
1.0.0:
|
||||||
@ -23,8 +25,7 @@ __all__ = [
|
|||||||
"random_forest_regressor",
|
"random_forest_regressor",
|
||||||
]
|
]
|
||||||
|
|
||||||
import sklearn
|
import sklearn, sklearn.ensemble, sklearn.naive_bayes
|
||||||
from sklearn import ensemble, model_selection
|
|
||||||
from . import ClassificationMetric, RegressionMetric
|
from . import ClassificationMetric, RegressionMetric
|
||||||
|
|
||||||
def random_forest_classifier(data, labels, test_size, n_estimators, criterion="gini", max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features="auto", max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, oob_score=False, n_jobs=None, random_state=None, verbose=0, warm_start=False, class_weight=None):
|
def random_forest_classifier(data, labels, test_size, n_estimators, criterion="gini", max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features="auto", max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, oob_score=False, n_jobs=None, random_state=None, verbose=0, warm_start=False, class_weight=None):
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import RegressionMetric'
|
# this should be imported as a python module using 'from tra_analysis import RegressionMetric'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.0"
|
__version__ = "1.0.1"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.1:
|
||||||
|
- optimized imports
|
||||||
1.0.0:
|
1.0.0:
|
||||||
- ported analysis.RegressionMetric() here
|
- ported analysis.RegressionMetric() here
|
||||||
"""
|
"""
|
||||||
@ -21,7 +23,6 @@ __all__ = [
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import metrics
|
|
||||||
|
|
||||||
class RegressionMetric():
|
class RegressionMetric():
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import SVM'
|
# this should be imported as a python module using 'from tra_analysis import SVM'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.2"
|
__version__ = "1.0.3"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.3:
|
||||||
|
- optimized imports
|
||||||
1.0.2:
|
1.0.2:
|
||||||
- fixed __all__
|
- fixed __all__
|
||||||
1.0.1:
|
1.0.1:
|
||||||
@ -30,7 +32,6 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import svm
|
|
||||||
from . import ClassificationMetric, RegressionMetric
|
from . import ClassificationMetric, RegressionMetric
|
||||||
|
|
||||||
class CustomKernel:
|
class CustomKernel:
|
||||||
|
@ -16,7 +16,7 @@ __changelog__ = """changelog:
|
|||||||
|
|
||||||
__author__ = (
|
__author__ = (
|
||||||
"Arthur Lu <learthurgo@gmail.com>",
|
"Arthur Lu <learthurgo@gmail.com>",
|
||||||
"James Pan <zpan@imsa.edu>"
|
"James Pan <zpan@imsa.edu>",
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
# this should be imported as a python module using 'from tra_analysis import StatisticalTest'
|
# this should be imported as a python module using 'from tra_analysis import StatisticalTest'
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.2"
|
__version__ = "1.0.3"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.3:
|
||||||
|
- optimized imports
|
||||||
1.0.2:
|
1.0.2:
|
||||||
- added tukey_multicomparison
|
- added tukey_multicomparison
|
||||||
- fixed styling
|
- fixed styling
|
||||||
@ -61,7 +63,6 @@ __all__ = [
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy
|
import scipy
|
||||||
from scipy import stats, interpolate
|
|
||||||
|
|
||||||
def ttest_onesample(a, popmean, axis = 0, nan_policy = 'propagate'):
|
def ttest_onesample(a, popmean, axis = 0, nan_policy = 'propagate'):
|
||||||
|
|
||||||
@ -279,9 +280,9 @@ def get_tukeyQcrit(k, df, alpha=0.05):
|
|||||||
cv001 = c[:, 2::2]
|
cv001 = c[:, 2::2]
|
||||||
|
|
||||||
if alpha == 0.05:
|
if alpha == 0.05:
|
||||||
intp = interpolate.interp1d(crows, cv005[:,k-2])
|
intp = scipy.interpolate.interp1d(crows, cv005[:,k-2])
|
||||||
elif alpha == 0.01:
|
elif alpha == 0.01:
|
||||||
intp = interpolate.interp1d(crows, cv001[:,k-2])
|
intp = scipy.interpolate.interp1d(crows, cv001[:,k-2])
|
||||||
else:
|
else:
|
||||||
raise ValueError('only implemented for alpha equal to 0.01 and 0.05')
|
raise ValueError('only implemented for alpha equal to 0.01 and 0.05')
|
||||||
return intp(df)
|
return intp(df)
|
||||||
|
@ -16,6 +16,8 @@ __changelog__ = """changelog:
|
|||||||
- deprecated titanlearn.py
|
- deprecated titanlearn.py
|
||||||
- deprecated visualization.py
|
- deprecated visualization.py
|
||||||
- removed matplotlib from requirements
|
- removed matplotlib from requirements
|
||||||
|
- removed extra submodule imports in Analysis
|
||||||
|
- added typehinting, docstrings for each function
|
||||||
3.0.0:
|
3.0.0:
|
||||||
- incremented version to release 3.0.0
|
- incremented version to release 3.0.0
|
||||||
3.0.0-rc2:
|
3.0.0-rc2:
|
||||||
@ -45,6 +47,7 @@ __all__ = [
|
|||||||
"Analysis",
|
"Analysis",
|
||||||
"Array",
|
"Array",
|
||||||
"ClassificationMetric",
|
"ClassificationMetric",
|
||||||
|
"Clustering",
|
||||||
"CorrelationTest",
|
"CorrelationTest",
|
||||||
"Expression",
|
"Expression",
|
||||||
"Fit",
|
"Fit",
|
||||||
|
Loading…
Reference in New Issue
Block a user