python

y = b + a * x: linear regressiony = b + a1 * x + a2 * x^2 -> 선형 회귀로 b, a1, a2를 결정할 수 있다. y = b + a1 * x1 + a2 * x2: 선형 회귀y = b + a1 * x1 + a2 * x2 + a3 * x1^2 + a4 * x1 * x2 + a5 * x2^2 import numpy as npimport matplotlib.pyplot as plt # Training Set - data : 범위 -3
사이킷런의 linear_regression 사용하기 위한 패키지 importimport numpy as npimport matplotlib.pyplot as pltfrom sklearn import linear_modelfrom sklearn.datasets import load_diabetes 비만 데이터 LoadX, y = load_diabetes(return_X_y=True)print(X[:5])print(X.shape, y.shape) [[ 0.03807591 0.05068012 0.06169621 0.02187235 -0.0442235 -0.03482076 -0.04340085 -0.00259226 0.01990842 -0.01764613][-0.00188202 -0.04464164 -0.051..
import pandas as pd # 1. 데이터 준비col_names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'Class'] # csv 파일에서 DataFrame을 생성dataset = pd.read_csv('iris.csv', encoding='UTF-8', header=None, names=col_names) # DataFrame 확인print(dataset.shape) # (row개수, column개수)print(dataset.info()) # 데이터 타입, row 개수, column 개수, 컬럼 데이터 타입print(dataset.describe()) # 요약 통계 정보 (150, 5) RangeIndex: 150 e..
"""icrawler 패키지를 이용해서, Google 이미지 검색 결과의 이미지들을 다운로드> pip install icrawler"""from icrawler.builtin import GoogleImageCrawlerimport os # 이미지 저장 폴더 경로save_dir = os.path.join('..', '..', 'images')# GoogleImageCrawler 객체 생성google_crawler = GoogleImageCrawler(storage={'root_dir': save_dir})google_crawler.crawl(keyword='펭수', max_num=50) 결과 >> 위의 결과는 images.google.com에서 '펭수' 검색 결과를 가져온 것이다. 그 밖에 여러 검색 조..
Codezoy
'python' 태그의 글 목록 (4 Page)