Commit 84ac58ea authored by Martino Bertoni's avatar Martino Bertoni 🌋
Browse files

last round of import fixing for lite package

parent 4ec97a01
......@@ -64,6 +64,9 @@ From: centos
pip install scipy
pip install sqlalchemy
pip install paramiko
pip install sklearn
pip install csvsort
pip install seaborn
# unittest utils
pip install pytest
pip install mock
......
......@@ -7,7 +7,6 @@ import shelve
import tempfile
import datetime
import numpy as np
from gensim import corpora, models
from scipy.sparse import lil_matrix
from sklearn.externals import joblib
from sklearn.decomposition import PCA
......@@ -81,6 +80,11 @@ class sign1(BaseSignature):
sign0(sign0): a `sign0` instance.
validations(boolean):Create validation files(plots, files,etc)(default:True)
"""
try:
from gensim import corpora, models
except ImportError:
raise ImportError("requires gensim " +
"https://radimrehurek.com/gensim/")
# Calling base class to trigger file existence checks
BaseSignature.fit(self)
# if not isinstance(sign0, Sign0.__class__):
......@@ -409,6 +413,11 @@ class sign1(BaseSignature):
current signature data path.
validations(boolean):Create validation files(plots, files,etc)(default:False)
"""
try:
from gensim import corpora, models
except ImportError:
raise ImportError("requires gensim " +
"https://radimrehurek.com/gensim/")
# Calling base class to trigger file existence checks
BaseSignature.predict(self)
plot = Plot(self.dataset, self.stats_path, self.validation_path)
......@@ -747,6 +756,11 @@ class sign1(BaseSignature):
# B: Number of runs, to ensure robustness
# N: Size of the random sample sample (1000 should be enough, 100
# works)
try:
from gensim import corpora
except ImportError:
raise ImportError("requires gensim " +
"https://radimrehurek.com/gensim/")
mm = corpora.MmCorpus(tfidf_corpus)
......
......@@ -10,7 +10,6 @@ from scipy.stats import pearsonr
from sklearn.metrics import r2_score, mean_squared_error
from sklearn.metrics import explained_variance_score
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
try:
import adanet
import tensorflow as tf
......
......@@ -10,7 +10,6 @@ from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.colors as colors
from matplotlib import pyplot as plt
from chemicalchecker.util import logged
......@@ -315,7 +314,7 @@ class MultiPlot():
sns.set_style("whitegrid")
fig, ax = plt.subplots(figsize=(7, 5), dpi=100)
norm = colors.BoundaryNorm(
norm = matplotlib.colors.BoundaryNorm(
boundaries=[2**i for i in range(5, 11)], ncolors=256)
# drawing the function
im = ax.pcolormesh(X, Y, Z, norm=norm, cmap=plt.cm.Blues)
......
......@@ -24,7 +24,6 @@ from sklearn.metrics.pairwise import cosine_distances
import matplotlib
matplotlib.use('Agg')
import seaborn as sns
import matplotlib as mpl
from matplotlib import pyplot as plt
import matplotlib.patches as patches
import matplotlib.patheffects as path_effects
......@@ -507,7 +506,7 @@ class Plot():
cdict['green'].append((pos, color[1], color[1]))
cdict['blue'].append((pos, color[2], color[2]))
cmap = mpl.colors.LinearSegmentedColormap(
cmap = matplotlib.colors.LinearSegmentedColormap(
'my_colormap', cdict, 256)
return cmap
......
......@@ -20,7 +20,10 @@ requirements = [
'autologging',
'scipy',
'sqlalchemy',
'paramiko'
'paramiko',
'sklearn',
'csvsort',
'seaborn'
]
setup_requirements = ['pytest-runner']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment