Esempio n. 1
0
    coupon_list_feature_file = full_data_path + "coupon_list_train.csv"
    coupon_detail_feature_file = full_data_path + "coupon_detail_train.csv"
    coupon_visit_feature_file = full_data_path + "coupon_visit_train.csv"
    prefecture_location_file = full_data_path + "prefecture_locations.csv"
    coupon_area_file = full_data_path + "coupon_area_test.csv"
    out_file = csv.writer(open("test_idvs.csv", "w"))
    model_start_date = datetime.date(2012, 06, 24)  # (year, month, day)
    model_end_date = datetime.date(2012, 06, 30)

    # getting User Dict from user file #
    print "Getting User Dict.."
    user_dict = getUserDict(user_file)

    # getting the coupons used for train and features #
    print "Getting Coupon Dict.."
    coupon_list_train_dict = getCouponDict(coupon_list_train_file)
    coupon_list_feature_dict = getCouponDict(coupon_list_feature_file)

    # getting the DV Dict of that has purchase combination of userid and coupon id #
    print "Getting DV Dict..."
    #dv_dict = getDVDict(coupon_detail_train_file, coupon_list_train_dict.keys())
    dv_dict = {}

    # getting the dict of past coupon purcahse details of user from coupon_detail #
    print "Getting Coupon purchase details.."
    coupon_purchase_detail_dict = getCouponPurchaseDict(
        coupon_detail_feature_file)

    # Getting prefecture location details #
    print "Getting Prefecture location details.. "
    prefecture_location_dict = getPrefectureLocationDict(
    ##coupon_detail_train_file = model_data_path + "coupon_detail_val.csv"
    coupon_detail_feature_file = model_data_path + "coupon_detail_dev.csv"
    coupon_visit_feature_file = model_data_path + "coupon_visit_dev.csv"
    prefecture_location_file = full_data_path + "prefecture_locations.csv"
    coupon_area_file = full_data_path + "coupon_area_train.csv"
    model_start_date = datetime.date(2012, 06, 17)  # (year, month, day)
    ##model_end_date = datetime.date(2012, 06, 23)

    # getting User Dict from user file #
    print "Getting User Dict.."
    user_dict = getUserDict(user_file)

    # getting the coupons used for train and features #
    print "Getting Coupon Dict.."
    ##coupon_list_train_dict = getCouponDict(coupon_list_train_file)
    coupon_list_feature_dict = getCouponDict(coupon_list_feature_file)

    # getting coupons daywise #
    daywise_coupon_list_dict = getDayWiseCoupons(coupon_list_feature_file)

    ## getting the DV Dict of that has purchase combination of userid and coupon id #
    ##print "Getting DV Dict..."
    ##dv_dict = getDVDict(coupon_detail_train_file, coupon_list_train_dict.keys())

    # getting the dict of past coupon purcahse details of user from coupon_detail #
    print "Getting Coupon purchase details.."
    coupon_purchase_detail_dict = getCouponPurchaseDict(coupon_detail_feature_file)

    # Getting prefecture location details #
    print "Getting Prefecture location details.. "
    prefecture_location_dict = getPrefectureLocationDict(prefecture_location_file)