<commit_before># -*- coding: utf-8 -*-
"""
Created on Tue Feb 17 21:31:48 2015

@author: andrew_woizesko
"""

class EventClassifier(object):
    """
    Class that will be used to classify user input
    events. The event classifier will use the model 
    from build.py
    """
    
    def __init__(self, model=None):
        """
        Initialize the event classifier with the model
        created in build.py
        """
        pass
    
    def classify(self):
        """
        This is the function that will take the user 
        input and return the probability that the 
        user will encounter a crime on their trip
        """
        pass
    
    def explain(self):
        """
        Not sure if we'll need this.
        """
        pass
    

if __name__ == "__main__":
    print "Need to code this up!"
    raw_input("\nPress enter to quit.")<commit_msg>wrote in loading of pickle model and event classifier probability predict<commit_after># -*- coding: utf-8 -*-
"""
Created on Tue Feb 17 21:31:48 2015

@author: andrew_woizesko
"""
###########################################################################
## Imports
###########################################################################

import pickle

from conf import settings
from build import BuildEventPlanner

###########################################################################
## Event Classifier
###########################################################################

class EventClassifier(object):
    """
    Class that will be used to classify user input
    events. The event classifier will use the model 
    from build.py
    """
    
    def __init__(self, model=None):
        """
        Initialize the event classifier with the model
        created in build.py
        """
        
		## Get the default model from the settings if it isn't passed in
		model = model or settings.model
		
		## Load the model from the pickle
		with open(model, 'rb') as pkl:
			self._classifier = pickle.load(pkl)
			
    
    def classify(self, instance):
        """
        This is the function that will take the user 
        input (instance) and return the probability that the 
        user will encounter a crime on their trip
        """
        		
		## Use the classifier to predict the probabilities of each crime
		event_prob = self._classifier.predict_proba(instance)
		
		return event_prob
    
    def explain(self):
        """
        Not sure if we'll need this.
        """
		## Don't think we need this
        pass
    

if __name__ == "__main__":
    classifier = EventClassifier()
	
{'fraction_non_alphanumeric': 0.1868764389869532, 'fraction_numerical': 0.009976976208749041, 'mean_word_length': 2.595862068965517, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3915403', 'n_tokens_mistral': 709, 'n_tokens_neox': 639, 'n_words': 254}