{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyOOB9uu9pwtnHtfajs04PdT"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":16,"metadata":{"id":"DG5gGFyhgE_K","executionInfo":{"status":"ok","timestamp":1710599938894,"user_tz":-420,"elapsed":1049,"user":{"displayName":"Nhật Quang Đoàn","userId":"10175964550021301622"}}},"outputs":[],"source":["import numpy as np\n","import pandas as pd\n","from sklearn.datasets import load_breast_cancer, fetch_california_housing\n","from sklearn.feature_selection import SelectFromModel\n","from sklearn.linear_model import Lasso, LogisticRegression\n","from sklearn.model_selection import train_test_split\n","from sklearn.preprocessing import StandardScaler"]},{"cell_type":"code","source":["breast_cancer = load_breast_cancer()\n","X = pd.DataFrame(breast_cancer.data, columns=breast_cancer.feature_names)\n","y = breast_cancer.target\n","X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)\n"],"metadata":{"id":"S9s_HLXVgTvu","executionInfo":{"status":"ok","timestamp":1710599940631,"user_tz":-420,"elapsed":313,"user":{"displayName":"Nhật Quang Đoàn","userId":"10175964550021301622"}}},"execution_count":17,"outputs":[]},{"cell_type":"code","source":["scaler = StandardScaler()\n","scaler.fit(X_train)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":74},"id":"TKmrxvrogXmH","executionInfo":{"status":"ok","timestamp":1710599949063,"user_tz":-420,"elapsed":397,"user":{"displayName":"Nhật Quang Đoàn","userId":"10175964550021301622"}},"outputId":"a163f11f-4b3d-4cac-a622-559b65b4f4f0"},"execution_count":18,"outputs":[{"output_type":"execute_result","data":{"text/plain":["StandardScaler()"],"text/html":["
StandardScaler()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
StandardScaler()
SelectFromModel(estimator=LogisticRegression(C=0.5, penalty='l1',\n"," random_state=10,\n"," solver='liblinear'))In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
SelectFromModel(estimator=LogisticRegression(C=0.5, penalty='l1',\n"," random_state=10,\n"," solver='liblinear'))
LogisticRegression(C=0.5, penalty='l1', random_state=10, solver='liblinear')
LogisticRegression(C=0.5, penalty='l1', random_state=10, solver='liblinear')