eb6f045d6067781b48641e25bb72085591c45c17,tests/ci_tests/tests.py,,basic_test,#Any#Any#Any#Any#Any#,6

Before Change



    // Create & Learn
    mdb = mindsdb.Predictor(name="home_rentals_price")
    mdb.learn(to_predict="rental_price",from_data="https://s3.eu-west-2.amazonaws.com/mindsdb-example-data/home_rentals.csv",backend=backend, stop_training_in_x_seconds=20,use_gpu=use_gpu)

    // Reload & Predict
    model_name = "home_rentals_price"
    if run_extra:

After Change


            os.system(f"python3 ../functional_testing/{py_file}")

    // Create & Learn
    to_predict = "rental_price"
    mdb = mindsdb.Predictor(name="home_rentals_price")
    //mdb.learn(to_predict=to_predict,from_data="https://s3.eu-west-2.amazonaws.com/mindsdb-example-data/home_rentals.csv",backend=backend, stop_training_in_x_seconds=20,use_gpu=use_gpu)

    // Reload & Predict
    model_name = "home_rentals_price"
    if run_extra:
        mdb.rename_model("home_rentals_price", "home_rentals_price_renamed")
        model_name = "home_rentals_price_renamed"

    mdb = mindsdb.Predictor(name=model_name)
    prediction = mdb.predict(when={"sqft":300}, use_gpu=use_gpu)

    // Test all different forms of output
    // No need to print them, we"re just doing so for debugging purposes, we just want to see if the interface will crash or not

    print(prediction)
    print(prediction[0])

    for item in prediction:
        print(item)


    print(type(list(prediction.evaluations.values())[0][0]))
    assert("ProbabilityEvaluation" in str(type(list(prediction.evaluations.values())[0][0])))

    for p in prediction:
        print(p)
    print(prediction[0].as_dict())
    print(prediction[0].as_list())
    print(prediction[0]["rental_price_confidence"])
    print(type(prediction[0]["rental_price_confidence"]))

    print("\n\n========================\n\n")
    print(prediction[0].explain())
    print("\n\n")

    // See if we can get the adapted metadata
    amd = mdb.get_model_data(model_name)
    // Make some simple assertions about it

    // @TODO: Sometimes are None, not sure why: [, validation_set_accuracy, accuracy]
    for k in ["status", "name", "version", "data_source", "current_phase", "updated_at", "created_at", "train_end_at"]:
        assert(type(amd[k]) == str)
    assert(type(amd["predict"]) == list or type(amd["predict"]) == str)
    assert(type(amd["is_active"]) == bool)

    for k in amd["data_preparation"]:
        assert(type(amd["data_preparation"][k]) == int or type(amd["data_preparation"][k]) == float)

    assert(type(amd["validation_set_accuracy"]) == float)
    assert(type(amd["accuracy"]) == float)

    for k in amd["data_analysis"]:
        assert(len(amd["data_analysis"][k]) > 0)
        assert(type(amd["data_analysis"][k][0]) == dict)

    assert(len(amd["model_analysis"]) > 0)
    assert(type(amd["model_analysis"][0]) == dict)

    for k in amd["force_vectors"][to_predict]["normal_data_distribution"]:
        assert(len(amd["force_vectors"][to_predict]["normal_data_distribution"][k]) > 0)

    for k in amd["force_vectors"][to_predict]["missing_data_distribution"]:
        for sk in amd["force_vectors"][to_predict]["missing_data_distribution"][k]:
            assert(len(amd["force_vectors"][to_predict]["missing_data_distribution"][k][sk]) > 0)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: mindsdb/mindsdb
Commit Name: eb6f045d6067781b48641e25bb72085591c45c17
Time: 2019-11-19
Author: george@cerebralab.com
File Name: tests/ci_tests/tests.py
Class Name:
Method Name: basic_test


Project Name: mindsdb/mindsdb
Commit Name: 0bb4d15f4051f656105cb4f9644cf45752b4cd9a
Time: 2019-03-04
Author: george@cerebralab.com
File Name: integration_testing/run_a_file.py
Class Name:
Method Name:


Project Name: mindsdb/mindsdb
Commit Name: ff6583db5ca535a6bea60afe94d510efc75b96a3
Time: 2019-07-03
Author: george@cerebralab.com
File Name: test.py
Class Name:
Method Name: