<commit_before>import mclearn
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC, LinearSVC
from sklearn.linear_model import LogisticRegression


class TestNormalise(object):
    @classmethod
    def setup_class(cls):
        cls.sdss = pd.io.parsers.read_csv("mclearn/tests/data/sdss_tiny.csv")
        cls.uncorrected_features = ['psfMag_u', 'psfMag_g', 'psfMag_r', 'psfMag_i', 'psfMag_z', 'petroMag_u',
                                    'petroMag_g', 'petroMag_r', 'petroMag_i', 'petroMag_z', 'petroRad_r']
        cls.target_col = 'class'
 

    def test_plot_class_distribution(self):
        fig = plt.figure(figsize=(10, 5))
        ax = mclearn.viz.plot_class_distribution(self.sdss['class'])


    def test_plot_hex_map(self):
        fig = plt.figure(figsize=(10,5))<commit_msg>Import matplotlib first in test<commit_after>import matplotlib
matplotlib.use('Agg')
import mclearn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC, LinearSVC
from sklearn.linear_model import LogisticRegression


class TestNormalise(object):
    @classmethod
    def setup_class(cls):
        cls.sdss = pd.io.parsers.read_csv("mclearn/tests/data/sdss_tiny.csv")
        cls.uncorrected_features = ['psfMag_u', 'psfMag_g', 'psfMag_r', 'psfMag_i', 'psfMag_z', 'petroMag_u',
                                    'petroMag_g', 'petroMag_r', 'petroMag_i', 'petroMag_z', 'petroRad_r']
        cls.target_col = 'class'
 

    def test_plot_class_distribution(self):
        fig = plt.figure(figsize=(10, 5))
        ax = mclearn.viz.plot_class_distribution(self.sdss['class'])


    def test_plot_hex_map(self):
        fig = plt.figure(figsize=(10,5))
{'fraction_non_alphanumeric': 0.09784560143626571, 'fraction_numerical': 0.005385996409335727, 'mean_word_length': 4.147806004618937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2864822', 'n_tokens_mistral': 777, 'n_tokens_neox': 744, 'n_words': 159}