# Path: moloi/descriptors/rdkit_descriptor.py
# def rdkit_fetures_names():
#     DESCRIPTORS = {_camel_to_snail(s): f for (s, f) in Descriptors.descList}
#     return DESCRIPTORS.keys()
# 
# Path: moloi/descriptors/mordred_descriptor.py
# def mordred_fetures_names():
#     calc = Calculator(descriptors)
#     cols = []
#     for i in calc.descriptors:
#         i = str(i)
#         i = i.split(".")[-1]
#         cols.append(str(i))
#     return cols
# 
# Path: moloi/data_processing.py
# def m_mean(a, column):
#     """
#     for feature importance
#     """
#     mean = np.mean(a.T[column])
#     for i in range(len(a)):
#         a[i][column] = mean
#     return a


import os
import pylab
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mlp
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from mpl_toolkits.mplot3d import Axes3D # keep it
from sklearn.metrics import roc_auc_score, roc_curve, r2_score, mean_absolute_error
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from joblib import Parallel, delayed
from joblib.parallel import BACKENDS
from moloi.descriptors.rdkit_descriptor import rdkit_fetures_names
from moloi.descriptors.mordred_descriptor import mordred_fetures_names
from moloi.data_processing import m_mean

    if len(np.unique(y)) == 3:
        ax1.scatter(coordinates[np.where(y == 2)[0], 0],
                    coordinates[np.where(y == 2)[0], 1],
                    c=c3, s=s, alpha=alpha, label=label_3[0])

    ax1.set_title(titles[0])
    ax1.legend()

    ax2 = fig.add_subplot(122)
    ax2.scatter(coordinates[np.where(y_a == 1)[0], 0],
                coordinates[np.where(y_a == 1)[0], 1],
                c=c1, s=s, alpha=alpha, label=label_1[1])
    ax2.scatter(coordinates[np.where(y_a == 0)[0], 0],
                coordinates[np.where(y_a == 0)[0], 1],
                c=c2, s=s, alpha=alpha, label=label_2[1])

    if len(np.unique(y_a)) == 3:
        ax2.scatter(coordinates[np.where(y_a == 2)[0], 0],
                    coordinates[np.where(y_a == 2)[0], 1],
                    c=c3, s=s, alpha=alpha, label=label_3[1])

    ax2.set_title(titles[1])
    ax2.legend()
    fig.savefig(path)  # , dpi=150)
    fig.clf()


def find_importances(i, X, y_test, model, value_test, metric):
    x_test = np.array(list(X[:]))

# Path: moloi/descriptors/rdkit_descriptor.py
# def rdkit_fetures_names():
#     DESCRIPTORS = {_camel_to_snail(s): f for (s, f) in Descriptors.descList}
#     return DESCRIPTORS.keys()
# 
# Path: moloi/descriptors/mordred_descriptor.py
# def mordred_fetures_names():
#     calc = Calculator(descriptors)
#     cols = []
#     for i in calc.descriptors:
#         i = str(i)
#         i = i.split(".")[-1]
#         cols.append(str(i))
#     return cols
# 
# Path: moloi/data_processing.py
# def m_mean(a, column):
#     """
#     for feature importance
#     """
#     mean = np.mean(a.T[column])
#     for i in range(len(a)):
#         a[i][column] = mean
#     return a


# Path: moloi/plots.py
import os
import pylab
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mlp
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from mpl_toolkits.mplot3d import Axes3D # keep it
from sklearn.metrics import roc_auc_score, roc_curve, r2_score, mean_absolute_error
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from joblib import Parallel, delayed
from joblib.parallel import BACKENDS
from moloi.descriptors.rdkit_descriptor import rdkit_fetures_names
from moloi.descriptors.mordred_descriptor import mordred_fetures_names
from moloi.data_processing import m_mean


    if len(np.unique(y)) == 3:
        ax1.scatter(coordinates[np.where(y == 2)[0], 0],
                    coordinates[np.where(y == 2)[0], 1],
                    c=c3, s=s, alpha=alpha, label=label_3[0])

    ax1.set_title(titles[0])
    ax1.legend()

    ax2 = fig.add_subplot(122)
    ax2.scatter(coordinates[np.where(y_a == 1)[0], 0],
                coordinates[np.where(y_a == 1)[0], 1],
                c=c1, s=s, alpha=alpha, label=label_1[1])
    ax2.scatter(coordinates[np.where(y_a == 0)[0], 0],
                coordinates[np.where(y_a == 0)[0], 1],
                c=c2, s=s, alpha=alpha, label=label_2[1])

    if len(np.unique(y_a)) == 3:
        ax2.scatter(coordinates[np.where(y_a == 2)[0], 0],
                    coordinates[np.where(y_a == 2)[0], 1],
                    c=c3, s=s, alpha=alpha, label=label_3[1])

    ax2.set_title(titles[1])
    ax2.legend()
    fig.savefig(path)  # , dpi=150)
    fig.clf()


def find_importances(i, X, y_test, model, value_test, metric):
    x_test = np.array(list(X[:]))

    x = m_mean(x_test, i)