|
4444 | 4444 | "data.to_csv('moon.csv', index=False)" |
4445 | 4445 | ] |
4446 | 4446 | }, |
| 4447 | + { |
| 4448 | + "cell_type": "markdown", |
| 4449 | + "metadata": {}, |
| 4450 | + "source": [ |
| 4451 | + "# Sklearn Data Sets" |
| 4452 | + ] |
| 4453 | + }, |
| 4454 | + { |
| 4455 | + "cell_type": "code", |
| 4456 | + "execution_count": 6, |
| 4457 | + "metadata": {}, |
| 4458 | + "outputs": [], |
| 4459 | + "source": [ |
| 4460 | + "from sklearn.datasets import make_classification\n", |
| 4461 | + "import pandas as pd\n", |
| 4462 | + "import numpy as np\n", |
| 4463 | + "X, y = make_classification(n_samples=1000, n_features=20, n_informative=2, n_redundant=2, n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None, flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, shuffle=True, random_state=None)\n", |
| 4464 | + "# combine the training and test data and save to a csv file\n", |
| 4465 | + "data = pd.DataFrame(np.hstack((X, y.reshape(-1, 1))))\n", |
| 4466 | + "data.columns = [f\"x{i}\" for i in range(1, 21)] + [\"y\"]\n", |
| 4467 | + "data.to_csv('binary_classification.csv', index=False)\n", |
| 4468 | + "\n" |
| 4469 | + ] |
| 4470 | + }, |
| 4471 | + { |
| 4472 | + "cell_type": "code", |
| 4473 | + "execution_count": 8, |
| 4474 | + "metadata": {}, |
| 4475 | + "outputs": [], |
| 4476 | + "source": [ |
| 4477 | + "from sklearn.datasets import make_classification\n", |
| 4478 | + "import pandas as pd\n", |
| 4479 | + "import numpy as np\n", |
| 4480 | + "X, y = make_classification(n_samples=1000, n_features=20, n_informative=9, n_redundant=2, n_repeated=0, n_classes=10, n_clusters_per_class=2, weights=None, flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, shuffle=True, random_state=None)\n", |
| 4481 | + "# combine the training and test data and save to a csv file\n", |
| 4482 | + "data = pd.DataFrame(np.hstack((X, y.reshape(-1, 1))))\n", |
| 4483 | + "data.columns = [f\"x{i}\" for i in range(1, 21)] + [\"y\"]\n", |
| 4484 | + "data.to_csv('multiple_classification.csv', index=False)" |
| 4485 | + ] |
| 4486 | + }, |
| 4487 | + { |
| 4488 | + "cell_type": "code", |
| 4489 | + "execution_count": 10, |
| 4490 | + "metadata": {}, |
| 4491 | + "outputs": [], |
| 4492 | + "source": [ |
| 4493 | + "from sklearn.datasets import make_regression\n", |
| 4494 | + "import pandas as pd\n", |
| 4495 | + "import numpy as np\n", |
| 4496 | + "X, y = make_regression(n_samples=1000, n_features=20, n_informative=10, n_targets=1, bias=0.0, effective_rank=None, tail_strength=0.5, noise=0.0, shuffle=True, coef=False, random_state=None)\n", |
| 4497 | + "# combine the training and test data and save to a csv file\n", |
| 4498 | + "data = pd.DataFrame(np.hstack((X, y.reshape(-1, 1))))\n", |
| 4499 | + "data.columns = [f\"x{i}\" for i in range(1, 21)] + [\"y\"]\n", |
| 4500 | + "data.to_csv('regression.csv', index=False)\n" |
| 4501 | + ] |
| 4502 | + }, |
| 4503 | + { |
| 4504 | + "cell_type": "code", |
| 4505 | + "execution_count": 11, |
| 4506 | + "metadata": {}, |
| 4507 | + "outputs": [ |
| 4508 | + { |
| 4509 | + "data": { |
| 4510 | + "text/plain": [ |
| 4511 | + "True" |
| 4512 | + ] |
| 4513 | + }, |
| 4514 | + "execution_count": 11, |
| 4515 | + "metadata": {}, |
| 4516 | + "output_type": "execute_result" |
| 4517 | + } |
| 4518 | + ], |
| 4519 | + "source": [ |
| 4520 | + "bool(1)" |
| 4521 | + ] |
| 4522 | + }, |
4447 | 4523 | { |
4448 | 4524 | "cell_type": "code", |
4449 | 4525 | "execution_count": null, |
|
0 commit comments