2022년 4월 25일 월요일

Orange3에서 혼공머신러닝+딥러닝 예제 따라하기

Orange3에 있는 Python Script를 이용하면 Orange3의 활용성이 매우 좋아집니다.

혼공머신러닝에 나온 예제를 풀어보기위한 간단한 예제를 보입니다.


Python Script를 더블크릭한후 아래와 같이 수정합니다.(복사붙이기)

    

from Orange.data import Table, Domain, ContinuousVariable, DiscreteVariable

import numpy as np


domain = Domain([ContinuousVariable("length"), ContinuousVariable("weight"), ContinuousVariable("target")])


bream_length = [25.4, 26.3, 26.5, 29.0, 29.0, 29.7, 29.7, 30.0, 30.0, 30.7, 31.0, 31.0, 31.5, 32.0, 32.0, 32.0, 33.0, 33.0, 33.5, 33.5, 34.0, 34.0, 34.5, 35.0, 35.0, 35.0, 35.0, 36.0, 36.0, 37.0, 38.5, 38.5, 39.5, 41.0, 41.0]


bream_weight = [242.0, 290.0, 340.0, 363.0, 430.0, 450.0, 500.0, 390.0, 450.0, 500.0, 475.0, 500.0, 500.0, 340.0, 600.0, 600.0, 700.0, 700.0, 610.0, 650.0, 575.0, 685.0, 620.0, 680.0, 700.0, 725.0, 720.0, 714.0, 850.0, 1000.0, 920.0, 955.0, 925.0, 975.0, 950.0]


smelt_length = [9.8, 10.5, 10.6, 11.0, 11.2, 11.3, 11.8, 11.8, 12.0, 12.2, 12.4, 13.0, 14.3, 15.0]

smelt_weight = [6.7, 7.5, 7.0, 9.7, 9.8, 8.7, 10.0, 9.9, 9.8, 12.2, 13.4, 12.2, 19.7, 19.9]


length = bream_length + smelt_length

weight = bream_weight + smelt_weight


target = np.array([1]*35 + [0]*14)


arr = np.array([[x,y,z] for x,y,z in zip(length, weight, target)])

out_data = Table.from_numpy(domain, arr)


그리고 왼쪽 아래 [RUN]버튼을 눌러주시고 [Data Table]위젯으로 확인합니다. 타겟을 지정하기위해 Select Columns 위젯을 중간에 추가하였습니다.

만약 스크립트 실행에러가 나면 오렌지를 다시실행하고 해보세요.

Educational Group 에 Create Table 이라는 위젯이 있어서 일일이 키보드로 입력할 수 도 있습니다.



댓글 없음:

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...