예제 #1
0
                        help="comma-separated item IDs for loved items")
    parser.add_argument('--like',
                        type=csv,
                        help="comma-separated item IDs for liked items")
    parser.add_argument('--neutral',
                        type=csv,
                        help="comma-separated item IDs for neutral items")
    parser.add_argument('--dislike',
                        type=csv,
                        help="comma-separated item IDs for disliked items")
    parser.add_argument('--hate',
                        type=csv,
                        help="comma-separated item IDs for hated items")
    args = parser.parse_args()

    model = LatentFactorsModel(args.model_path)

    tastes = {}
    if args.love is not None:
        for item in args.love:
            tastes[item] = 1.0
    if args.like is not None:
        for item in args.like:
            tastes[item] = 0.75
    if args.neutral is not None:
        for item in args.neutral:
            tastes[item] = 0.5
    if args.dislike is not None:
        for item in args.dislike:
            tastes[item] = 0.25
    if args.hate is not None:
예제 #2
0
        '--max-features',
        type=int,
        help="""the maximum number of features to use in cross-validation
				(ignored if sampling size is not defined)""")
    parser.add_argument(
        '-o',
        '--output',
        type=str,
        help="output CSV filename, to store validation scores (MAE)")
    args = parser.parse_args()

    if not os.access(args.ratings_path, os.R_OK):
        print("'%s' is not readable." % args.ratings_path)
        sys.exit(0)

    model = LatentFactorsModel()

    if args.delimiter is not None:
        model.set_training_csv_delimiter(args.delimiter)

    if args.rank is not None:
        model.set_training_rank(args.rank)

    k = 10
    if args.folds is not None:
        k = args.folds

    feature_sampling = None
    if args.feature_sampling_interval is not None:
        feature_sampling_interval = args.feature_sampling_interval