4707229d41b18ac74ff186bf9a6874035c378719,common.py,,update_loglosses,#,69

Before Change


    cursor.execute("SELECT open_time FROM rounds WHERE number = {}".format(round_number))
    rounds = cursor.fetchall()
    round_open_time = rounds[0]
    print(round_open_time)

    // Get the truth data
    public_targets_db = connect_to_public_targets_db()
    validation_data = pd.read_sql("SELECT id, target FROM tournament_daily_encrypted WHERE date = "{}" AND data_type = "validation"".format(), public_targets_db)

After Change


    // Calculate logloss
    submission_validation_data = submission.loc[submission["id"].isin(validation_data["id"].as_matrix())].copy()
    submission_validation_data.sort_values("id", inplace=True)
    submission_test_data = submission.loc[submission["id"].isin(test_data["id"].as_matrix())].copy()
    submission_test_data.sort_values("id", inplace=True)
    validation_logloss = log_loss(validation_data["target"].as_matrix(), submission_validation_data["probability"].as_matrix())
    test_logloss = log_loss(test_data["target"].as_matrix(), submission_test_data["probability"].as_matrix())

    // Get the submission Postgres id
    query = "SELECT s.id FROM submissions s INNER JOIN users u ON s.user_id = u.id WHERE u.username = "{}" AND s.inserted_at = "{}"".format(mongo_submission["username"], mongo_submission["created"])
    cursor.execute(query)
    submission_id = cursor.fetchone()[0]

    query = "UPDATE submissions SET validation_logloss={}, test_logloss={} WHERE id = "{}"".format(validation_logloss, test_logloss, submission_id)
    cursor.execute(query)
    print("Updated {} with validation_logloss={} and test_logloss={}".format(submission_id, validation_logloss, test_logloss))
    postgres_db.commit()
    cursor.close()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: numerai/submission-criteria
Commit Name: 4707229d41b18ac74ff186bf9a6874035c378719
Time: 2017-11-10
Author: xander@numer.ai
File Name: common.py
Class Name:
Method Name: update_loglosses


Project Name: ina-foss/inaSpeechSegmenter
Commit Name: 4396573e860d553825702006aa335989356b45c8
Time: 2020-05-10
Author: ddoukhan@ina.fr
File Name: inaSpeechSegmenter/segmenter.py
Class Name: Segmenter
Method Name: batch_process


Project Name: scikit-learn/scikit-learn
Commit Name: fc06baef499b8e0a6d677d4a19fa983f173ad06c
Time: 2020-07-28
Author: 34657725+jeremiedbb@users.noreply.github.com
File Name: sklearn/cluster/_kmeans.py
Class Name:
Method Name: _kmeans_single_lloyd