This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// ======================================================= | |
// 본 자료는 CC0-1.0 라이선스를 따릅니다. | |
// https://creativecommons.org/publicdomain/zero/1.0/deed | |
// 저작권자의 허락을 구하지 않아도 상업적인 목적을 포함한 어떠한 목적으로든 | |
// 자유롭게 복사, 수정, 배포, 실연할 수 있습니다. | |
// ======================================================= | |
// 모든 정보는 직접 수집하여 정리한 정보입니다. | |
// 일부 정보가 오기되었거나, 위/경도 좌표가 부정확할 수 있습니다. | |
// Gist 댓글을 통해 오류를 제보해주세요. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql.functions import col, explode_outer | |
from pyspark.sql.types import * | |
from copy import deepcopy | |
from autoflatten import AutoFlatten | |
from collections import Counter | |
s3_path = 's3://mybucket/orders/' | |
df = spark.read.orc(s3_path) | |
json_df = spark.read.json(df.rdd.map(lambda row: row.json)) | |
json_schema = json_df.schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
class AutoFlatten: | |
def __init__(self, json_schema): | |
self.fields_in_json = self.get_fields_in_json(json_schema) | |
self.all_fields = {} | |
self.cols_to_explode = set() | |
self.structure = {} | |
self.order = [] | |
self.bottom_to_top = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### READ SPARK DATAFRAME | |
df = spark.read.option("header", "true").option("inferSchema", "true").csv(fname) | |
# store the schema from the CSV w/ the header in the first file, and infer the types for the columns | |
df_schema = df.schema | |
##### SAVE JSON SCHEMA INTO S3 / BLOB STORAGE | |
# save the schema to load from the streaming job, which we will load during the next job | |
dbutils.fs.rm("/home/mwc/airline_schema.json", True) | |
with open("/dbfs/home/mwc/airline_schema.json", "w") as f: |
유니코드에서 한글을 어떻게 다루는지를 정리하였다.
- 유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준 (위키 백과)
- 단순히 문자마다 번호를 붙임
- 계속 업데이트되며 현재는 Unicode Version 9.0.0 이 최신이다.
- 유니코드를 실제 파일 등에 어떻게 기록할 것인지를 표준화한 것이다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
com=${1:-"htop"} | |
tname=mon | |
twin=mon | |
tnw=$tname:$twin | |
tmux has-session -t $tname | |
if [ $? != 0 ] | |
then | |
tmux new-session -s $tname -n $twin -d ssh -t a1 "$com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import luigi modules | |
import luigi | |
from luigi.contrib import redshift | |
from luigi import configuration, s3 | |
# import python core modules | |
import os | |
import shutil | |
import datetime |
글쓴이: 김정주([email protected])
최근 딥러닝 관련 패키지들은 대부분 CPU와 GPU를 함께 지원하고 있습니다. GPU를 사용하면 보다 빠르게 학습 결과를 낼 수 있지만, GPU를 활용하기 위해서는 NVIDIA계열의 그래픽 카드, 드라이버 S/W 그리고 CUDA의 설치를 필요로 합니다.
이 글에서는 AWS의 GPU 인스턴스와 도커를 활용해 딥러닝 패키지(Caffe)를 편리하게 사용하는 방법을 소개합니다.
NewerOlder