fixed/optimized imports,

fixed headers

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2021-11-09 22:52:04 +00:00
parent d57745547f
commit dad195a00f
11 changed files with 37 additions and 40 deletions

View File

@ -7,10 +7,13 @@
# current benchmark of optimization: 1.33 times faster
# setup:
__version__ = "3.0.4"
__version__ = "3.0.5"
# changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog:
3.0.5:
- removed extra submodule imports
- fixed/optimized header
3.0.4:
- removed -_obj imports
3.0.3:
@ -361,7 +364,6 @@ __all__ = [
'histo_analysis',
'regression',
'Metric',
'kmeans',
'pca',
'decisiontree',
# all statistics functions left out due to integration in other functions
@ -374,21 +376,14 @@ __all__ = [
import csv
from tra_analysis.metrics import elo as Elo
from tra_analysis.metrics import glicko2 as Glicko2
import math
import numpy as np
import scipy
from scipy import optimize, stats
import sklearn
from sklearn import preprocessing, pipeline, linear_model, metrics, cluster, decomposition, tree, neighbors, naive_bayes, svm, model_selection, ensemble
import sklearn, sklearn.cluster
from tra_analysis.metrics import trueskill as Trueskill
import warnings
# import submodules
from .Array import Array
from .ClassificationMetric import ClassificationMetric
from .RegressionMetric import RegressionMetric
from . import SVM
class error(ValueError):
pass
@ -599,16 +594,7 @@ def npmin(data):
def npmax(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):
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)

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import ClassificationMetric'
# setup:
__version__ = "1.0.1"
__version__ = "1.0.2"
__changelog__ = """changelog:
1.0.2:
- optimized imports
1.0.1:
- fixed __all__
1.0.0:
@ -22,7 +24,6 @@ __all__ = [
]
import sklearn
from sklearn import metrics
class ClassificationMetric():

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import CorrelationTest'
# setup:
__version__ = "1.0.1"
__version__ = "1.0.2"
__changelog__ = """changelog:
1.0.2:
- optimized imports
1.0.1:
- fixed __all__
1.0.0:
@ -29,7 +31,6 @@ __all__ = [
]
import scipy
from scipy import stats
def anova_oneway(*args): #expects arrays of samples

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import KNN'
# setup:
__version__ = "1.0.0"
__version__ = "1.0.1"
__changelog__ = """changelog:
1.0.1:
- optimized imports
1.0.0:
- ported analysis.KNN() here
- removed classness
@ -23,7 +25,6 @@ __all__ = [
]
import sklearn
from sklearn import model_selection, neighbors
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

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import NaiveBayes'
# setup:
__version__ = "1.0.0"
__version__ = "1.0.1"
__changelog__ = """changelog:
1.0.1:
- optimized imports
1.0.0:
- ported analysis.NaiveBayes() here
- removed classness
@ -24,8 +26,7 @@ __all__ = [
]
import sklearn
from sklearn import model_selection, naive_bayes
from . import ClassificationMetric, RegressionMetric
from . import ClassificationMetric
def gaussian(data, labels, test_size = 0.3, priors = None, var_smoothing = 1e-09):

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import RandomForest'
# setup:
__version__ = "1.0.1"
__version__ = "1.0.2"
__changelog__ = """changelog:
1.0.2:
- optimized imports
1.0.1:
- fixed __all__
1.0.0:
@ -23,8 +25,7 @@ __all__ = [
"random_forest_regressor",
]
import sklearn
from sklearn import ensemble, model_selection
import sklearn, sklearn.ensemble, sklearn.naive_bayes
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):

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import RegressionMetric'
# setup:
__version__ = "1.0.0"
__version__ = "1.0.1"
__changelog__ = """changelog:
1.0.1:
- optimized imports
1.0.0:
- ported analysis.RegressionMetric() here
"""
@ -21,7 +23,6 @@ __all__ = [
import numpy as np
import sklearn
from sklearn import metrics
class RegressionMetric():

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import SVM'
# setup:
__version__ = "1.0.2"
__version__ = "1.0.3"
__changelog__ = """changelog:
1.0.3:
- optimized imports
1.0.2:
- fixed __all__
1.0.1:
@ -30,7 +32,6 @@ __all__ = [
]
import sklearn
from sklearn import svm
from . import ClassificationMetric, RegressionMetric
class CustomKernel:

View File

@ -16,7 +16,7 @@ __changelog__ = """changelog:
__author__ = (
"Arthur Lu <learthurgo@gmail.com>",
"James Pan <zpan@imsa.edu>"
"James Pan <zpan@imsa.edu>",
)
__all__ = [

View File

@ -4,9 +4,11 @@
# this should be imported as a python module using 'from tra_analysis import StatisticalTest'
# setup:
__version__ = "1.0.2"
__version__ = "1.0.3"
__changelog__ = """changelog:
1.0.3:
- optimized imports
1.0.2:
- added tukey_multicomparison
- fixed styling
@ -61,7 +63,6 @@ __all__ = [
import numpy as np
import scipy
from scipy import stats, interpolate
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]
if alpha == 0.05:
intp = interpolate.interp1d(crows, cv005[:,k-2])
intp = scipy.interpolate.interp1d(crows, cv005[:,k-2])
elif alpha == 0.01:
intp = interpolate.interp1d(crows, cv001[:,k-2])
intp = scipy.interpolate.interp1d(crows, cv001[:,k-2])
else:
raise ValueError('only implemented for alpha equal to 0.01 and 0.05')
return intp(df)

View File

@ -16,6 +16,8 @@ __changelog__ = """changelog:
- deprecated titanlearn.py
- deprecated visualization.py
- removed matplotlib from requirements
- removed extra submodule imports in Analysis
- added typehinting, docstrings for each function
3.0.0:
- incremented version to release 3.0.0
3.0.0-rc2:
@ -45,6 +47,7 @@ __all__ = [
"Analysis",
"Array",
"ClassificationMetric",
"Clustering",
"CorrelationTest",
"Expression",
"Fit",