code stringlengths 3 6.57k |
|---|
request.config.getoption('--tag') |
format(framework_version, processor, py_version) |
pytest.fixture(scope='session', name='docker_image') |
fixture_docker_image(docker_base_name, tag) |
format(docker_base_name, tag) |
opt_ml() |
tempfile.mkdtemp() |
os.mkdir(os.path.join(tmp, 'output') |
format(tmp) |
platform.system() |
shutil.rmtree(tmp, True) |
pytest.fixture(scope='session', name='use_gpu') |
fixture_use_gpu(processor) |
pytest.fixture(scope='session', name='build_base_image', autouse=True) |
fixture_build_base_image(request, framework_version, py_version, processor, tag, docker_base_name) |
request.config.getoption('--build-base-image') |
os.path.join(dir_path, '..') |
pytest.fixture(scope='session', name='sagemaker_session') |
fixture_sagemaker_session(region) |
Session(boto_session=boto3.Session(region_name=region) |
pytest.fixture(scope='session', name='sagemaker_local_session') |
fixture_sagemaker_local_session(region) |
LocalSession(boto_session=boto3.Session(region_name=region) |
pytest.fixture(name='aws_id', scope='session') |
fixture_aws_id(request) |
request.config.getoption('--aws-id') |
pytest.fixture(name='instance_type', scope='session') |
fixture_instance_type(request, processor) |
request.config.getoption('--instance-type') |
pytest.fixture(name='accelerator_type', scope='session') |
fixture_accelerator_type(request) |
request.config.getoption('--accelerator-type') |
pytest.fixture(name='docker_registry', scope='session') |
fixture_docker_registry(aws_id, region) |
format(aws_id, region) |
pytest.fixture(name='ecr_image', scope='session') |
fixture_ecr_image(docker_registry, docker_base_name, tag) |
format(docker_registry, docker_base_name, tag) |
pytest.fixture(autouse=True) |
skip_by_device_type(request, use_gpu, instance_type, accelerator_type) |
if (request.node.get_closest_marker('gpu_test') |
request.node.get_closest_marker('cpu_test') |
pytest.skip('Skipping because running on \'{}\' instance'.format(instance_type) |
elif (request.node.get_closest_marker('gpu_test') |
request.node.get_closest_marker('cpu_test') |
pytest.skip('Skipping because running on \'{}\' instance'.format(instance_type) |
request.node.get_closest_marker('eia_test') |
pytest.skip('Skipping because running on \'{}\' instance'.format(instance_type) |
pytest.fixture(autouse=True) |
skip_by_py_version(request, py_version) |
request.node.get_closest_marker('skip_py2') |
pytest.skip('Skipping the test because Python 2 is not supported.') |
pytest.fixture(autouse=True) |
skip_gpu_instance_restricted_regions(region, instance_type) |
if (region in NO_P2_REGIONS and instance_type.startswith('ml.p2') |
or (region in NO_P3_REGIONS and instance_type.startswith('ml.p3') |
pytest.skip('Skipping GPU test in region {}'.format(region) |
pytest.fixture(autouse=True) |
skip_gpu_py2(request, use_gpu, instance_type, py_version, framework_version) |
request.node.get_closest_marker('skip_gpu_py2') |
pytest.skip('Skipping the test until mms issue resolved.') |
plot_confusion_matrix(confusion_matrix, classes_list, normalize=True, figsize=(10, 7) |
optional (default=(10,7) |
optional (default=14) |
optional (default="Blues") |
plot_confusion_matrix(array, classes_list) |
np.array(confusion_matrix) |
plt.subplots(figsize=figsize) |
np.array(confusion_matrix) |
astype('float') |
np.array(confusion_matrix) |
sum(axis=1) |
plt.matshow(df_cm, fignum=0, cmap=cmap) |
plt.matshow(df_cm, fignum=0, cmap=cmap) |
ax.set_xticks(np.arange(len(classes_list) |
ax.set_yticks(np.arange(len(classes_list) |
ax.set_xticklabels(classes_list) |
ax.set_yticklabels(classes_list) |
plt.setp(ax.get_xticklabels() |
range(len(classes_list) |
range(len(classes_list) |
ax.text(j, i, confusion_matrix[i, j], ha="center", va="center", color="grey", fontsize=fontsize) |
plt.ylabel('True labels') |
plt.xlabel('Predicted labels') |
plt.show() |
plot_roc_curve(y_test, y_pred_probas, proba_step=None) |
int (optional) |
datasets.make_moons(noise=0.3, random_state=0) |
train_test_split(X, y, test_size=.5, random_state=0) |
RandomForestClassifier(n_estimators=10, random_state=42) |
clf.fit(X_train, y_train) |
clf.predict_proba(X_test) |
plot_roc_curve(y_test, y_pred_probas, proba_step=2) |
roc_curve(y_test, y_pred_probas[:, 1]) |
auc(fpr, tpr) |
plt.figure() |
plt.plot(fpr, tpr, color='darkorange', lw=lw, marker='.') |
plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--') |
zip(fpr, tpr, thresholds) |
plt.annotate(np.round(txt, 2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.