Sha256: 90806c979c498ffc1b3814145c966b04191bd24f8de8707cc0be5535a3be6769
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
require_relative "setup.rb" class ValidationTest < MiniTest::Test def test_fminer_crossvalidation dataset = Dataset.from_csv_file "#{DATA_DIR}/hamster_carcinogenicity.csv" model = Model::LazarFminerClassification.create dataset cv = ClassificationCrossValidation.create model p cv.accuracy p cv.weighted_accuracy refute_empty cv.validation_ids assert cv.accuracy > 0.8 assert cv.weighted_accuracy > cv.accuracy, "Weighted accuracy (#{cv.weighted_accuracy}) larger than unweighted accuracy(#{cv.accuracy}) " end def test_classification_crossvalidation dataset = Dataset.from_csv_file "#{DATA_DIR}/hamster_carcinogenicity.csv" model = Model::LazarClassification.create dataset#, features cv = ClassificationCrossValidation.create model p cv.accuracy p cv.weighted_accuracy assert cv.accuracy > 0.7 assert cv.weighted_accuracy > cv.accuracy, "Weighted accuracy should be larger than unweighted accuracy." end def test_regression_crossvalidation dataset = Dataset.from_csv_file "#{DATA_DIR}/EPAFHM.medi.csv" #dataset = Dataset.from_csv_file "#{DATA_DIR}/EPAFHM.csv" model = Model::LazarRegression.create dataset cv = RegressionCrossValidation.create model p cv.rmse p cv.weighted_rmse p cv.mae p cv.weighted_mae #`inkview #{cv.plot}` assert cv.rmse < 30, "RMSE > 30" assert cv.weighted_rmse < cv.rmse, "Weighted RMSE (#{cv.weighted_rmse}) larger than unweighted RMSE(#{cv.rmse}) " assert cv.mae < 12 assert cv.weighted_mae < cv.mae end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazar-0.0.7 | test/validation.rb |