Exemplo n.º 1
0
def customerAnalytics():
    """
	Description: Purchase prediction based on the quote transactions and scores generated 
	from social media like facebook and twitter. Since customer sentiment is derived from the number of followers
	from that state. Keeping the scores at level at the moment due to the inability to compute much more detailed metrics.
	"""
    train_data = "../data/train.csv"
    test_data = "../data/test_v2.csv"

    data = ProcessData()
    df_train = data.get_data(train_data)
    df_train = data.clean_data(df_train)

    X, y = data.featurize_data(df_train, db)
    del df_train  # memory optimization

    #Build model and run validation

    clf = RandomForestClassifier(verbose=10,
                                 n_estimators=10,
                                 n_jobs=-1,
                                 max_features=5)
    model = ModelValidation()
    baselineclf = model.get_score(clf, X, y)
    """
	Build a pickle for web app to start the purchase prediction ( compute conversion scores)

	"""
    cp.dump(clf, open('predict-purchase', "wb"))
Exemplo n.º 2
0
def customerAnalytics():
	"""
	Description: Purchase prediction based on the quote transactions and scores generated 
	from social media like facebook and twitter. Since customer sentiment is derived from the number of followers
	from that state. Keeping the scores at level at the moment due to the inability to compute much more detailed metrics.
	"""
	train_data = "../data/train.csv"
	test_data = "../data/test_v2.csv"

	data = ProcessData()
	df_train = data.get_data(train_data)
	df_train = data.clean_data(df_train)

	X,y= data.featurize_data(df_train, db)
	del df_train # memory optimization


	#Build model and run validation

	clf = RandomForestClassifier(verbose=10, n_estimators=10, n_jobs=-1, max_features=5)
	model = ModelValidation()
	baselineclf = model.get_score(clf,X,y)

	"""
	Build a pickle for web app to start the purchase prediction ( compute conversion scores)

	"""
	cp.dump(clf, open( 'predict-purchase', "wb"))
Exemplo n.º 3
0
    def __init__(self):
        rec_data = "../data/train.csv"
        data = ProcessData()
        df_rec = data.get_data(rec_data)
        df_rec = data.clean_data(df_rec)
        df_rec = df_rec[df_rec.record_type == 1]
        sf = SFrame(data=df_rec)
        del df_rec  # memory optimization

        self.modelA = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="A")
        self.modelB = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="B")
        self.modelC = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="C")
        self.modelD = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="D")
        self.modelE = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="E")
        self.modelF = recommender.create(sf,
                                         user_column="customer_ID",
                                         item_column="F")
Exemplo n.º 4
0
    def __init__(self):
        rec_data = "../data/train.csv"
        data = ProcessData()
        df_rec = data.get_data(rec_data)
        df_rec = data.clean_data(df_rec)
        df_rec = df_rec[df_rec.record_type == 1]
        sf = SFrame(data=df_rec)
        del df_rec  # memory optimization

        self.modelA = recommender.create(sf, user_column="customer_ID", item_column="A")
        self.modelB = recommender.create(sf, user_column="customer_ID", item_column="B")
        self.modelC = recommender.create(sf, user_column="customer_ID", item_column="C")
        self.modelD = recommender.create(sf, user_column="customer_ID", item_column="D")
        self.modelE = recommender.create(sf, user_column="customer_ID", item_column="E")
        self.modelF = recommender.create(sf, user_column="customer_ID", item_column="F")