-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Update pythonwhat is_instance documentation #382
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,32 @@ Check Multiple Choice | |
"That's a clown who likes burgers.", | ||
"Correct! Head over to the next exercise!"]) | ||
|
||
Recommended approach for testing train test splits | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code:: | ||
|
||
# solution | ||
# Perform the train-test split | ||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain where this function comes from (just mention library). |
||
|
||
# sct | ||
Ex().check_correct( | ||
multi( | ||
check_object("X_train").has_equal_value(), | ||
check_object("X_test").has_equal_value(), | ||
check_object("y_train").has_equal_value(), | ||
check_object("y_test").has_equal_value() | ||
), | ||
check_function("sklearn.model_selection.train_test_split").multi( | ||
check_args(["arrays", 0]).has_equal_value("Did you correctly pass in the feature variable to `train_test_split()`?"), | ||
check_args(["arrays", 1]).has_equal_value("Did you correctly pass in the target variable to `train_test_split()`?"), | ||
check_args(["options", "test_size"]).has_equal_value("Did you specify the correct train test split?"), | ||
check_args(["options", "random_state"]).has_equal_value("Don't change the `random_state` argument we set for you.") | ||
) | ||
) | ||
|
||
|
||
Check import | ||
~~~~~~~~~~~~ | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -204,7 +204,7 @@ def is_instance(state, inst, not_instance_msg=None): | |||
used to 'zoom in' on the object of interest. | ||||
|
||||
Args: | ||||
inst (class): The class that the object should have. | ||||
inst (str): The class that the object should have as a string. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation is correct according to the implementation and this test: pythonwhat/tests/test_check_object.py Line 83 in e0befeb
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, found what you mean, going to look into it |
||||
not_instance_msg (str): When specified, this overrides the automatically generated message in case | ||||
the object does not have the expected class. | ||||
state (State): The state that is passed in through the SCT chain (don't specify this). | ||||
|
@@ -220,7 +220,7 @@ def is_instance(state, inst, not_instance_msg=None): | |||
|
||||
# Verify the class of arr | ||||
import numpy | ||||
Ex().check_object('arr').is_instance(numpy.ndarray) | ||||
Ex().check_object('arr').is_instance('numpy.ndarray') | ||||
""" | ||||
|
||||
state.assert_is(["object_assignments"], "is_instance", ["check_object"]) | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a link to this section.
That section should mention that the names of these arguments are not fixed, something like: