STUDY/DRL 8

2021.07.02 빅데이터 분석을 위한 스파크 프로그래밍 - clustering

# 분류 from pyspark.ml.classification import DecisionTreeClassifier from pyspark.ml.evaluation import BinaryClassificationEvaluator from pyspark.ml.feature import StringIndexer from pyspark.ml.feature import VectorAssembler from pyspark.ml.pipeline import Pipeline from pyspark.sql import SparkSession from pyspark.sql import functions spark = SparkSession \ .builder \ .appName("classfication_sample..

STUDY/DRL 2021.07.02

2021.06.30 빅데이터 분석을 위한 스파크 프로그래밍 - 머신 러닝

# 레이블 : 올바른 출력값 지도 학습 : 입력에 대한 올바른 출력 값과 입력 값을 함께 학습 후 아직 답이 알려지지 않은 새로운 입력 값에 대한 출력 값 찾는 학습 방식 - 레이블을 포함한 데이터 셋 = LabeledPoint 데이터 타입 사용 # 연속형 데이터 / 이산형 데이터 연속 : 무게, 온도, 습도 = 연속적인 값 이산 : 나이, 성별, 개수 = 불연속적인 값 스파크 Mlib 에서 제공하는 API 사용 시 모두 double 타입 데이터만 사용 가능 # 알고리즘, 모델 모델 : 알고리즘의 산출물 (알고리즘 + 데이터) 학습 : 알고리즘에 데이터를 적용하는 과정, 결과물은 모델 (=함수) 스파크 Mlib 에서, 로지스틱 회귀 알고리즘 - LogisticRegression 클래스 (fit에 훈련 데..

STUDY/DRL 2021.06.30

2021.06.29 빅데이터 분석을 위한 스파크 프로그래밍 - DataFrame 함수

# sample_df1, sample_df2, ldf, rdf # sample dataFrame 1 Person = collections.namedtuple('Person', 'name age job') row1 = Person(name="hayoon", age=7, job="student") row2 = Person(name="sunwoo", age=13, job="student") row3 = Person(name="hajoo", age=5, job="kindergartener") row4 = Person(name="jinwoo", age=13, job="student") data = [row1, row2, row3, row4] sample_df = spark.createDataFrame(data) ..

STUDY/DRL 2021.06.29

2021.06.28 빅데이터 분석을 위한 스파크 프로그래밍 - DataFrame, DataSet

## dataframe_sample.py, word.py class Word: def __init__(self, word, count): self.word = word self.count = count # createDataFrame() import collections from pyspark import StorageLevel from pyspark.sql import Row from pyspark.sql import SparkSession from pyspark.sql.functions import * from pyspark.sql import functions from pyspark.sql.types import * from pyspark.sql.window import Window import t..

STUDY/DRL 2021.06.28

2021.06.25 빅데이터 분석을 위한 스파크 프로그래밍 - RDD 트랜스포메이션 ~ 액션

https://ralasun.github.io/spark%20programming/2020/12/07/rdd(2)/ RDD, Resilient Distributed Dataset에 대하여[2] - RDD기본액션, RDD트랜스포메이션 · Ralasun Resarch Blog RDD, Resilient Distributed Dataset에 대하여[2] - RDD기본액션, RDD트랜스포메이션 07 Dec 2020 | data-engineering 이번 포스팅은 지난 포스팅 에 이어서 진행하도록 하겠습니다. 교재는 빅데이터 분석을 위한 스파 ralasun.github.io https://ralasun.github.io/spark%20programming/2021/01/07/rdd(3)/ RDD, Resilien..

STUDY/DRL 2021.06.25

2021.06.25 빅데이터 분석을 위한 스파크 프로그래밍 - virtualbox로 intellij 시작하기

sudo apt install git pip3 install jupyter ## github 소스 가져오기 VCS -> get from version control -> github.com/wikibook/spark code 주소 복사 url에 입력 파이썬 버전 명시 프로젝트 세팅 / 프로젝트 / 자바에서 파이썬으로 변경 master에다 local대신 spark://IP_ADRESS:7077 #collect : driver로 출력하게 해줌 #doMap() cd $SPARK_HOME cd bin ./spark-submit --master spark://20.194.22.56:7077 /PATH/FILE.py (conf.set()이랑 master 없애줘야함) #mapPartitions() - 파티션 단위로 ..

STUDY/DRL 2021.06.25

2021.06.23 빅데이터 분석을 위한 스파크 프로그래밍 - VirtualBox 통해 pyspark 실행하기

virtual box 다운로드 https://www.virtualbox.org/wiki/Downloads 가상머신 만들기 이름 스파크2 리눅스, 우분투로 설정 - 메모리 4096 - 새 가상 디스크 만들기 - VDI - 동적 할당 - 하드 20 Ubuntu 18.04.5 LTS (Bionic Beaver) Select an image Ubuntu is distributed on three types of images described below. Desktop image The desktop image allows you to try Ubuntu without changing your computer at all, and at your option to install it permanently later..

STUDY/DRL 2021.06.23