11e9c7adfbf7d50dd9ef4442cf7806cdb2ee2368,samples/core/get_started/custom_estimator.py,,main,#Any#,105

Before Change


    test_x = dict(test_x)

    // Feature columns describe the input: all columns are numeric.
    feature_columns = [tf.feature_column.numeric_column(col_name)
                       for col_name in COLUMNS[:-1]]

    // Build 3 layer DNN with 10, 20, 10 units respectively.
    classifier = tf.estimator.Estimator(
        model_fn=my_model,
        params={
            "feature_columns": feature_columns,
            "hidden_units": [10, 20, 10],
            "n_classes": 3,
        })

    // Train the Model.
    train = (
        make_dataset(train_x, train_y)
        .repeat()
        .shuffle(1000)
        .batch(args.batch_size))
    classifier.train(input_fn=from_dataset(train), steps=args.train_steps)

    // Evaluate the model.
    test = make_dataset(test_x, test_y).batch(args.batch_size)
    eval_result = classifier.evaluate(input_fn=from_dataset(test))
    print("\nTest set accuracy: {accuracy:0.3f}\n".format(**eval_result))

    // Generate predictions from the model
    predict_input = make_dataset({

After Change


        "PetalWidth": [0.5, 1.5, 2.1],
    }

    predictions = classifier.predict(
        input_fn=lambda:eval_input_fn(predict_x, batch_size=args.batch_size))

    for pred_dict, expec in zip(predictions, expected):
        template = ("\nPrediction is "{}" ({:.1f}%), expected "{}"")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: tensorflow/models
Commit Name: 11e9c7adfbf7d50dd9ef4442cf7806cdb2ee2368
Time: 2017-11-17
Author: markdaoust@google.com
File Name: samples/core/get_started/custom_estimator.py
Class Name:
Method Name: main


Project Name: rushter/MLAlgorithms
Commit Name: 01e68e64b745ebc5ef4a3b8c52e2ee9f3cac4cfb
Time: 2016-10-17
Author: me@rushter.com
File Name: mla/ensemble/random_forest.py
Class Name: RandomForestRegressor
Method Name: _predict


Project Name: shubhomoydas/ad_examples
Commit Name: 562508c5edf9988078f3ca4300e1d6be569a4b8f
Time: 2018-04-01
Author: smd.shubhomoydas@gmail.com
File Name: python/timeseries/timeseries_customRNN.py
Class Name: TsRNNCustom
Method Name: train


Project Name: tensorflow/models
Commit Name: 11e9c7adfbf7d50dd9ef4442cf7806cdb2ee2368
Time: 2017-11-17
Author: markdaoust@google.com
File Name: samples/core/get_started/premade_estimator.py
Class Name:
Method Name: main