-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
260 additions
and
27 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# tests.test_regressor | ||
# Ensure that the regressor visualizations work. | ||
# | ||
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> | ||
# Created: Fri Jun 03 14:20:02 2016 -0700 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: test_regressor.py [] benjamin@bengfort.com $ | ||
|
||
""" | ||
Ensure that the regressor visualizations work. | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## | ||
|
||
import unittest | ||
|
||
from yellowbrick.regressor import * | ||
from yellowbrick.utils import * | ||
|
||
from sklearn.ensemble import RandomForestRegressor | ||
from sklearn.svm import SVR | ||
|
||
########################################################################## | ||
## Prediction error test case | ||
########################################################################## | ||
|
||
class PredictionErrorTests(unittest.TestCase): | ||
|
||
def test_init_pe_viz(self): | ||
""" | ||
Ensure that both a single model and multiple models can be rendered | ||
""" | ||
viz = PredictionError([RandomForestRegressor(), SVR()]) | ||
self.assertEqual(len(viz.models), 2) | ||
|
||
viz = PredictionError(SVR()) | ||
self.assertEqual(len(viz.models), 1) | ||
|
||
def test_init_pe_names(self): | ||
""" | ||
Ensure that model names are correctly extracted | ||
""" | ||
viz = PredictionError([RandomForestRegressor(), SVR()]) | ||
self.assertEqual(viz.names, ["RandomForestRegressor", "SVR"]) | ||
|
||
viz = PredictionError(SVR()) | ||
self.assertEqual(viz.names, ["SVR"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters