mydistance <- function(x,y){

  if (x > y){

    temp <- x-y

    return(temp)

  }

  else{

    temp <- y-x

    return(temp)

  }

}




myVectorSum <- function(){

  x <- c()

  for(i in 1:5){

    x[i] <- i

    

  }

  return(x)

}


# 짝수 더하기

myEvenSum <- function(x){

  y <- 0

  for(i in 1:x){

    if (i%%2 == 0){

      y <- y+ i  

    }

  }

  return(y)

}



#빈칸 NA 제외 처리

myNotNaSum <- function(x){

  y <- 0

  for(i in 1:length(x)){

    if (!is.na(x[i])){

      y <- y+ x[i] 

    }

  }

  return(y)

}


#뉴튼법 대상 추출방법

f <- function (x) exp(x) -2

(result <- uniroot(f, c(0,1)))


#다항식 -2 + 5x -4x^2 + x^3

polyroot(c(-2,5,-4,1))


#미분

f<-expression(a*x^4)

D(f, "x")


#고계미분 결과 a * (4 * (3 * (2 * x)))

DD<- function(expr, name, order =1){

  if(order <1 ) stop("'order' must be >= 1")

  if(order ==1) D(expr, name)

  else DD(D(expr, name), name, order -1)

}

DD(f,"x" ,3)



#수식 이용 미분할때 deriv(~ 수식, 미분할 변수, func=T)

f <- deriv(~ x^2, "x", func=T)

#4 인수에 대한 함수값

#attr(,"gradient")

#x

#[1,] -4 미분한 함수 


# 다변함수 미분

g <- deriv(~ x^2*y, c("x","y"), func=TRUE)

g(2,3)

#[1] 12 인수에 대한 함수의 값

#attr(,"gradient") 인수에 대한 미분한 후의 함수의 값

#x y x ㄹ 일계 미분한 결과로 사용해서 계산한 것(12)과

#[1,] 12 4 y로 일계 미분한 결과를 사용해서 계산한것 (4)


h<- deriv(~ x^2*y*z, c("x","y"), function(x,y,z=4){ })

h(3,2)


#적분 integrate()

f <-  function(x) x^2 # function 선언

integrate(f, 0 ,1)

#원래 R 준비된 함수 적분시에는 따로 새로 함수 정의 필요 X

integrate(sin, 0 , pi)


#dnorm 정규 분포의 밀도 함수

integrate(dnorm, -Inf, 1.96) # 정규분포 밀도함수를 -Inf(-무한대) ~ 1.96 범위에서 적분하고 있다.


#cubature 패키지 안에있는 함수 adaptIntegrate 사용하면 일차원 과 다차원 수치 적분을 할 수 있다.

install.packages("cubature", dep=T) # cubature pacakge 설치

library(cubature)

f<- function(x) cos(x) #1변 함수일때

adaptIntegrate(f, 0, pi/2) #실행

g<- function(x){ # 2변 함수일때

  exp(-(x[1]^2 + x[2]^2) /2) / (2 * pi)

}

adaptIntegrate(g, c(-3,-3), c(3,3)) #인수로 벡터지정 실행



'Data Science > R' 카테고리의 다른 글

시계열분석  (0) 2015.09.25
R 도움말 & 함수 확인  (0) 2015.09.10
R공부 Example 3회차  (0) 2015.09.08
Posted by MIDDLE
,

- 탐색적 데이터 분석

- 탐색적 데이터 분석과 보고를 위한 시각화

- 대시보드와 척도의 관리

- 비즈니스에 대한 영감의 발견

- 데이터 주도 의사결정

- 데이터공학/ 빅데이터(맵리듀스, 하둡, 하이브, 피그)

- 데이트 수집

- 데이터 파이프라인 구축( 로그 -> 맵리듀스 -> 데이터세트-> 다른 데이터와의 결합-> 맵 리듀스-> 스크래프 데이터-> 결합)

-(존재하는 상품 용법을 설명하는대신) 상품의 개발

-해킹

-특허 출원

-수사 업무

-미래 행동이나 성과예측

- 보고서, 발표자료 , 저널에 결과 기고

- 프로그래밍(R, 파이썬, C, 자바 등)

- 조건 확률

- 최적화

- 알고리즘, 통계적 모형, 기계학습

-스토리를 말하고 해석하기

-좋은 질문하기

-조사

-연구

-데이터로부터 추론하기

-데이터 상품 개발

- 대규모 데이터 프로세싱, 변형, 분석방법 도출

- 온전성 검사

- 영역 전문가와 협력 ( 혹 영역 전문가 되기)

- 실험의 설계및 분석

-데이터에서 상과능ㄹ 발견하고 인과성 확립하기


를 포함하여 모범 규준ㅇ들을 사용하여 데이터와 함께 풀 수 있는 모든 문제의 공간을 포함하는 영역 포괄

데이터 과학이 어디서 어떤영역에서 등장하는가는 쟁점이 아니다 . 오히려 그것을 알고리즘, 코드 ,그리고 데이터에 해법공간을 가지고 있는 문제공간으로 정의하는 것이 필요하다.



'Cloud Service' 카테고리의 다른 글

Cloud 사용 기술들 정리  (0) 2015.04.23
Cloud 서비스  (0) 2015.04.13
Posted by MIDDLE
,

CrowdSourcing (많은 사람이 참여하여 문제를 해결하도록 하는 의미) 라는 아이디어 자체는 새롲비 않지만, 그 용어는 가장 최근 2006년에 생기기 시작했다. 기본 구상은 도전과제가 제시 되고, 참가자들은 최적의 해결책을 찾기위해 상호 독립적으로 경쟁한다는 것이다. 제임스 서로위키가 저술한 [대중의 지혜]의 중심주제는 어떤 현상에 대해 대중들이 전문가보다 평균적으로 훨씬 나은 결정을 한다는 것이다. 그것은 단지 대중들이 올바른 해결책에 도달할 수 있는 특정한 여건아래에서만 작동한다. 그것은 개인들이 독립적인 사고해야한다는 전제조건하에서다.서로 대화하는 집단에서는 집단사고가 발생할 수 있다. 


즉, 상호 영향 때문에 잘못된 해결책이 도출 될 수 있다. 어떤 문제는 크라우드 소싱방식으 접근이 잘맞는다.

아마존 메커니컬 터크(Amazon Mechanical Turk)는 사람들에게 과업이 주어지는 온라인 크라우드 소싱 서비스다. 예컨데'행복하다' 혹은 '슬프다'와 같은 분류명을 붙일 필요가 있는 일련의 이미지들이 있다. 이 분류명들은 지도 학습 문제를 위한  훈련데이터세트의 기초를 사용 될수 있다. 사람들이 분류명을 붙인 이미지들로 알고리즘을 훈련 시킨 다음에 새로운 이미지에 자동적으로 뷴류명을 붙이도록 할 수 있다. 그러므로 메커니컬 터크의 중심구상은 인간이 기계를 돕기위해 상당히 반복적인 일을 처리하고, 그런다음 그기계가 인간을 돕기 위해 업무를 자동화 한다는 것이다.

자동화가 필요한 과업이 있는 어느 연구자라도 참여자들에게 보상을 제공하는 한 아마존 멬니컬 터크를 이요할 수 있다. 또한 누구나 그 크라우드 소싱 서비스에 가입하고, 그것의 일부가 될 수 있다. 어느정도의 품질관리 이슈가 있기는 하지만 말이다. 만약 사람들이 실제로 이미지를 살펴보지 않은채 매 두이미지 마다 행복하다 라는 분류먕을 붙였고, 그것을 연구자들이 알아차린다면 분류명을 붙이는데 다시는 사람을 활용하지 않을 것이다.

메커니컬 터크는 사람을 도와주는 기계에 사람이 도움준다는 점에서 Artificial artificial intelligence 의 사례다.


캐글 경진 대회 : 크라우드 소싱 방식으로 참가하여 데이터 과학자로서 풀어나갈수 있다.

단독 참가자 : 훈련 데이터 세트와 검증 세트를 주어진다. 

서로간의 경쟁을 통해 뛰어난 정확도를 가진 모형을 만들기도 하지만 뛰어넘기 효과로 인해 효율은 좋지만 너무 복잡한 모형이 나와 터무니없이 복잡해 실제 생산에서는 쓸 수 없었다.




Posted by MIDDLE
,

햄릿 증후군??

개인공부 2015. 8. 5. 09:05

메이비 세대가 함의 하는것은 결정을 잘 내리지 못하는 현상이 개인의 나쁜 습관에만 기인 하는 것이 아니라, 기회 과잉의 바다에 빠뜨리고 수많은 선택을 강요하는 사회배경에도 일부 책임을 묻는다는 사실이다. 이제 햄릿 증후군은 세대론의 범주가 됐다. 결정에 어려움을 느끼는 소비자들은 그선택을 스스로 내리기보다 누군가의 도움을 얻어서라도 정답에 가까운 선택을 하려고한다.


이러한 문제를 해결하기 위해 다양한 앱과 사이트들에서는 전문가를 고용하여 사용자들을 손쉽게 고를수있도록 리스트업을 한다던지 하여서 사용자를 유도하는 방식을 사용한다.


이러한 사용자들을 끌어들이기 위해서는 전문가나 최적화에 대한 방법만이 전부일까? 한번 생각해보자.

Posted by MIDDLE
,

Maria DB 설치


1. 설치작업을 진행한다.


2. mysql -u root -p

로 접속하여서 사용할 데이터베이스 와 사용자 계정을 추가작업을 해준다.


3. 사용자 계정은 당장에 사용할 수 없기 때문에 

GRANT ALL PRIVILEGES ON DB명.* TO 계정아이디@'%' IDENTIFIED BY '비밀번호';

로 권한을 추가해준다.


mysql -u root -p


create database hsadb default character set utf8;


create user 'hsa'@'localhost' identified by 'hsa1234';


grant all privileges on hsadb.* to 'hsa'@'%' identified by 'hsa1234';


flush privileges;





4. mysqld 설정추가작업이 필요하다.

vi /etc/my.cnf 로 mysql 설정 작업 진행

[mysqld]

lower_case_table_names=1

character-set-client-handshake=FALSE

init_connect="SET collation_connection = utf8_general_ci"

init_connect="SET NAMES utf8"

character-set-server = utf8

collation-server = utf8_general_ci

sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"


5. mysql stop start

service mysql stop -> start

Posted by MIDDLE
,

vi 편집기 명령어

명령 모드로 돌아가려면 Esc 키를 누릅니다.

  • h , moves cursor left

  • , moves cursor down

  • k , moves cursor up

  • , moves cursor right

  • , delete character

  • ##x , delete ## characters

  • dw , delete word

  • dd , delete line

  • p , put last deletion after cursor

  • , undo last change

  • , turn on insert mode (hit the esc key twice to stop)

  • :w ,write to the file already named

  • :q , quit editing

  • :wq , write file and quit

  • :q! , quit without saving file

  • ctrl f , move forward one page

  • ctrl b , move backward one page

  • :/text , will search for next occurance of 'text' (hitting n will find next occurence)

  • :?text ,search backward for first occurrence of text

  • G , go to end of file

  • 1G , go to first line of file

  • set nu , to set line number

  • :w filename , write to the file named filename

  • yy , yank line into buffer

  • ##yy , yank ## lines into general buffer

  • CONTROL-G print information about file: name, current line number

  • :%s/pattern/text/ substitute first occurrence of pattern on each line with text

  • :%s/pattern/text/g substitute every occurrence of pattern with text

  • p , put contents of general buffer after current line

  • , put contents of general buffer before current line

  • :g/pattern/d delete every line containing pattern

시스템 업데이트 방법
네트워크가 설정되고 인터넷에 연결되고 나면, 가장 먼저 할 일은 업데이트 작업이다. 최초 배포판 이후에 알려진 버그 업데이트들을 시스템에 적용하는 것이다. 이 작업을 하기전에 몇가지 참고할 사항을 설명한다.

CentOS의 업데이트 서버 한국 미러서버에 mirror.khlug.org, data.nicehosting.co.kr가 있는데 속도 제한이 설정되어  1kb/sec의 속도가 나올정도로 느리다. 이로인해 업데이트 작업은 위서버들은 예외되도록 설정하자.
[root]# cat /etc/yum/pluginconf.d/fatestmirror.conf


나머지는 https://www.3rabbitz.com/f01c33e7d8367da2#857542b4ddd63403 여기서



'Cloud Service > CentOS' 카테고리의 다른 글

Oracle VirtualBox 이미지 생성  (0) 2015.07.03
Posted by MIDDLE
,

Oracle VM virtualVox를 설치합니다.


1. 설치 이후  새로만들기 버튼을 이용하여 이미지를 생성합니다. 

이름을 설정하고 이미지 OS의 종류와 해당 OS의 버전을 설정합니다.


2. OS와 버전 선택이 맞춘이후에는 Memory 크기를 선택합니다.


3. 하드 드라이브를 구성에 대해 선택하게 되는데

하드드라이브 자원을 가상화 하여 가상 하드드라이브를 만들거나 기존 가상하드 드라이브 파일사용하거나 가상하드를 추가하지 않기중 선택을 합니다.


4. 가상 하드드라이브 종류를 선택하여 나중에 이파일이 다른곳에 적용시키기를 원할때 이용가능합니다.


5. 물리적 하드드라이브에 저장할 것인지 선택하여 최대크기를 지정한 정적 할당을 할것인지 동적할당 하여 가상 디스크를 사용할때 고정된 최대크기가 커지지만 사용량이 줄어들어도 자동적으로 작아지지는 않습니다.


6. 파일 위치및 크기 선택 가상 드라이브 파일 위치와 가상 하드드라이브의 크기를 지정합니다.


생성된 가상 OS를 설정에 들어가

저장소에 접속하면 IDE 텝에 설치할 OS의 ISO파일을 삽입한 후 

해당 VM을 실행시키면 OS설치가 시작됩니다.



'Cloud Service > CentOS' 카테고리의 다른 글

CentOS Minimal 리눅스 서버  (0) 2015.07.03
Posted by MIDDLE
,

ㅇ 개발배경 및 목적

IoT Cloud 서비스 이두가지는 요즘 IT뿐만아니라 모든 분야에서 뜨거운 분야입니다. 저희는 이 두가지에 대해 생각을 해보면서 어떻게 하면 사람들에게 조금더 친숙하게 이러한 기술들을 제공을 할 수 있을까에대해 생각을 해보면서 구현을 해보기로 마음 먹었습니다.

저희들의 이 목표를 통해 이루고 싶은 것은 SaaS로 구성한 WebService에서 사용자가 원하는 기기에 대한 정보를 얻고 컨트롤을 손쉽게 제공 하기 위한 서비스를 구현하려고 합니다. 사용자는 개인 화면을 열기만 하면 어떠한 기기든지 상태 및 제어를 인터넷이되는 어떠한 환경속에서도 제어할 수 있도록 제공합니다.



지금 사용자들이 자신의 기기를 등록만 한다면 언제 어디서든지 인터넷이 되는 환경 속에서 기기에 대한 정보 및 제어 권한을 가져 올수 있게 되며 기존의 필요한 인력들에 대해 절약을 도모 할 수 있게 됩니다. 또한 이 서비스는 웹을 통하여 기기를 제어 하기 때문에 기기에 대한 데이터 및 제어에 대한 로그를 실시간으로 얻을 수 있으며 데이터가 중요시되는 이시대의 큰 발판이 될 수 있을것이라 생각합니다.


'아이디어 뱅크' 카테고리의 다른 글

시각화 자동 번역 어플리케이션  (0) 2016.04.26
컴퓨터의 발전 단계  (0) 2015.04.13
Posted by MIDDLE
,

BigBook Step2

GRE/Big Book 2015. 5. 11. 17:35

1. In the british theater under thirty-five have not had much trouble getting recognition onstage, but offstage - in the ranks of playwrights, directors, designers, administrators - they have mostly been relegated to relative obsurity.


2. An institution concerned about its reputation is at the mercy of the actions of its members, because the misdeeds of individuals are often used to discredit the institutions of which they are a part.


3. Since many casual smokers develop lung cancer and many heavy smokers do not, scientists believe that individuals differ in their susceptibility to the cancer-causing agens known to be present in cigarette smoke.


4. We accepted the theory that as people become more independent of one another, they begin to feel so isolated and lonely that freedom becomes a negative condition that most will seek to escape.


5.If animal parents were judged by human standards, the cuckoo would be one of nature's more feckless creatures, blithely laying its eggs in the nests of other birds, and leaving the incubating and nurturing to them.


6. The current penchant for touting a product by denigrating a rival, named in the adventisement by brand name, seems somewhat foolhardy: suppose the consumer remembers only the rival's name?


7. His imperturbability in the face of evidence indicating his deliberate fraud failed to reassure supporters of his essential probity; instead, it suggested a talent for guile that they had never suspected.


1. Although providing wild chimpanzees with food makes them less shy and easier to study. it is also known to disrupt their normal social patterns.


2. There is something incongruous about the way the building of monasteries proliferated in eighteenth-century Bavaria while in the rest of the Western would religious ardor was diminishing and church building was consequently declining.


3. Because they had various meanings in nineteenth century biological thought, "mechanism" and "vitalism" ought not to be considered univocal terms; thus I find the recent insistence that the terms had single definitions to be entirely erroneous.


4. Many Americans believe that individual initiative epitomized the 1890's and see the entrepreneur as the personfication of that age.


5. Neither the ideas of philosophers nor the practices of ordinary people can, by themselves, transform reality; what in fact changes reality and kindles revolution is the interplay of the two.



'GRE > Big Book' 카테고리의 다른 글

Big Book 1step  (0) 2015.05.11
Posted by MIDDLE
,

Big Book 1step

GRE/Big Book 2015. 5. 11. 13:29

1. Nonviolent demonstrations often create such tensions, that a community that has constantly refused to acknowledge Its injustices is forced to correct them: the injustices can no longer be ignored.



2. Since 1813 reaction to Jane Austen's novels has oscillated between adoration and condescension; but in general later writers have esteemed her works more highly than did most of her literary contemporaries.


3. There are, as yet, no vegetation types or ecosystems whose study has been exhausted to the extent that they no longer interest ecologists.


4. Under ethical guidelines recently adopted by the National Institutes of Health, human genes are to be manipulated only to correct diseases for which alternative treatments are unsatisfactory.


5. It was her view that the country's problems had been  exacerbated by foreign technocrats, so that to invite them to come back would be counterproductive.


6. Winsor McCay, the cartoonist, could draw with incredible virtuosity: his comic strip about Little Nemo was characterized by marvelous draftsmanship and sequencing.


7. The actual rigdity of Wilson's position was always betrayed by his refusal to compromise after having initially agreed to negotiate a settlement.


1. The senator's reputation, though shaken by false allegations of misconduct, emerged from the ordeal unscathed.


2. This poetry is not provincial; it is more likely to appeal to an international audience than is poetry with strictly regional themes.


3. Experienced employers recognize that business students who can assimilate differenct points of view are ultimately more effective as managers than are the brilliant and original students who adhere dogmatically to their own formulations.


4. Poe's insightful reviews of contemporary fiction, which often find great merit in otherwise unappreciated literary gems, must make us repect his critical judgment in addition to his well-known literary talent.


5. The significance of the manga carata lies no in its specific provisions, but in its broader impact: it made the king subject to the law.


6. The theory of cosmic evolution states that the universe, having begun in a state of simplicity and homogeneity, has differentiated into great variety.


7. Not wishing to appear presumptuous, the junior member of the research group refrained from venturing any criticism of the senior member's plan for dividing up responsibility for the entire project.






'GRE > Big Book' 카테고리의 다른 글

BigBook Step2  (0) 2015.05.11
Posted by MIDDLE
,