cli/streamingphish/streamingphish/trainer.py
def _train_model(self, features, labels_list):
        """
        Train model with features and labels generated from training set.

        Args:
            features (dictionary): Two keys - names and values, where names holds the feature
                vector and values holds the features from each FQDN from training.
            labels_list (list): Labels for training data (0 = benign, 1 = phishing).
        """
        # Convert to dataframe.
        features_df = pd.DataFrame.from_records(features['values'], columns=features['names'])

        # Save feature vector to the class object.
        self._feature_vector = features['names']

        # Convert labels list to numpy array. Assigning to self because I need to compute how
        # many samples from each class were present in _compute_metrics.
        self._labels = np.fromiter(labels_list, dtype=np.float)

        # Split training data from evaluation data. Assigning to class object because we'll use them
        # to help compute metrics against the classifier we're about to train.
        self._x_train, self._x_test, self._y_train, self._y_test = train_test_split(
            features_df.values, self._labels, random_state=2)

        # Train the model, son. Go on now.
        self._classifier = LogisticRegression(C=10).fit(self._x_train, self._y_train)
        tqdm.tqdm.write("[+] Training complete.")

        Train model with features and labels generated from training set.

        Args:
            features (dictionary): Two keys - names and values, where names holds the feature
                vector and values holds the features from each FQDN from training.
            labels_list (list): Labels for training data (0 = benign, 1 = phishing).
        
Train model with features and labels generated from training set.
Train model with features and labels generated from training set .
def _train_model(self, features, labels_list):
        features_df = pd.DataFrame.from_records(features['values'], columns=features['names'])
        self._feature_vector = features['names']
        self._labels = np.fromiter(labels_list, dtype=np.float)
        self._x_train, self._x_test, self._y_train, self._y_test = train_test_split(
            features_df.values, self._labels, random_state=2)
        self._classifier = LogisticRegression(C=10).fit(self._x_train, self._y_train)
        tqdm.tqdm.write("[+] Training complete.")
def _train_model ( self , features , labels_list ) : features_df = pd . DataFrame . from_records ( features [ 'values' ] , columns = features [ 'names' ] ) self . _feature_vector = features [ 'names' ] self . _labels = np . fromiter ( labels_list , dtype = np . float ) self . _x_train , self . _x_test , self . _y_train , self . _y_test = train_test_split ( features_df . values , self . _labels , random_state = 2 ) self . _classifier = LogisticRegression ( C = 10 ) . fit ( self . _x_train , self . _y_train ) tqdm . tqdm . write ( "[+] Training complete." )
Train model with features and labels generated from training set.
Train model with features and labels generated from training set .
"""
        Train model with features and labels generated from training set.

        Args:
            features (dictionary): Two keys - names and values, where names holds the feature
                vector and values holds the features from each FQDN from training.
            labels_list (list): Labels for training data (0 = benign, 1 = phishing).
        """ # Convert to dataframe. # Save feature vector to the class object. # Convert labels list to numpy array. Assigning to self because I need to compute how # many samples from each class were present in _compute_metrics. # Split training data from evaluation data. Assigning to class object because we'll use them # to help compute metrics against the classifier we're about to train. # Train the model, son. Go on now.
self
features
Two keys - names and values, where names holds the feature
vector and values holds the features from each FQDN from training.
Two keys - names and values where names holds the feature vector and values holds the features from each FQDN from training .
labels_list
Labels for training data (0 = benign, 1 = phishing).
Labels for training data ( 0 = benign 1 = phishing ) .