[ํ˜ผ์ž ๊ณต๋ถ€ํ•˜๋Š” ๋จธ์‹ ๋Ÿฌ๋‹+๋”ฅ๋Ÿฌ๋‹]

12 views
Skip to first unread message

๊น€๋™๊ตญ

unread,
Jan 9, 2023, 12:53:56โ€ฏAM1/9/23
to ๋จธ์‹ ๋Ÿฌ๋‹/๋”ฅ๋Ÿฌ๋‹ ๋„์„œ Q&A
5์žฅ ํŠธ๋ฆฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ 223ํŽ˜์ด์ง€

----------------
importย pandasย asย pd

fromย sklearn.model_selectionย importย train_test_split

wineย =ย pd.read_csv('https://bit.ly/wine-date')

#wine.describe()

dataย =ย wine[['alcohol',ย 'sugar',ย 'pH']].to_numpy()
targetย =ย wine['class'].to_numpy

train_input,ย test_input,ย train_target,ย test_targetย =ย train_test_split(data,ย target,ย test_size=0.2,ย random_state=42)

print(train_input.shape,ย test_input.shape)
-------------------------------------------
์œ„์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ–ˆ๋Š”๋ฐ ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜ ๋ฉ”์„ธ์ง€๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค.ย 

---------------------------------------
TypeError Traceback (most recent call last) <ipython-input-13-12dce3f42a43> in <module> 10 target = wine['class'].to_numpy 11 ---> 12 train_input, test_input, train_target, test_target = train_test_split(data, target, test_size=0.2, random_state=42) 13 14 print(train_input.shape, test_input.shape)
4 frames
/usr/local/lib/python3.8/dist-packages/sklearn/utils/validation.py in _num_samples(x) 267 if hasattr(x, "shape") and x.shape is not None: 268 if len(x.shape) == 0: --> 269 raise TypeError( 270 "Singleton array %r cannot be considered a valid collection." % x 271 )
---------------------------------------
์•„๋ฌด๋ฆฌ ๋ด๋„ ์˜ค๋ฅ˜ ์›์ธ์„ ์•Œ ์ˆ˜๊ฐ€ ์—†์–ด์„œ ๋„์›€ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Haesun Park

unread,
Jan 9, 2023, 1:05:41โ€ฏAM1/9/23
to ๊น€๋™๊ตญ, ๋จธ์‹ ๋Ÿฌ๋‹/๋”ฅ๋Ÿฌ๋‹ ๋„์„œ Q&A
์•ˆ๋…•ํ•˜์„ธ์š”. ๋ฐ•ํ•ด์„ ์ž…๋‹ˆ๋‹ค.
์–ด๋–ค ๋ฌธ์ œ ๋•Œ๋ฌธ์— ์ด๋Ÿฐ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”์ง€ ์ œ๊ฐ€ ์•Œ๊ธฐ ์–ด๋ ต๋„ค์š”.
์ฝ”๋žฉ์—์„œ ๊นƒํ—ˆ๋ธŒ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์‹œ๊ณ  ์ž‘์„ฑํ•˜์‹  ๋‚ด์šฉ๊ณผ ๋น„๊ตํ•ด ๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

2023๋…„ 1์›” 9์ผ (์›”) ์˜คํ›„ 2:53, ๊น€๋™๊ตญ <dgki...@gmail.com>๋‹˜์ด ์ž‘์„ฑ:
--
์ด ๋ฉ”์ผ์€ Google ๊ทธ๋ฃน์Šค '๋จธ์‹ ๋Ÿฌ๋‹/๋”ฅ๋Ÿฌ๋‹ ๋„์„œ Q&A' ๊ทธ๋ฃน์— ๊ฐ€์ž…ํ•œ ๋ถ„๋“ค์—๊ฒŒ ์ „์†ก๋˜๋Š” ๋ฉ”์‹œ์ง€์ž…๋‹ˆ๋‹ค.
์ด ๊ทธ๋ฃน์—์„œ ํƒˆํ‡ดํ•˜๊ณ  ๋” ์ด์ƒ ์ด๋ฉ”์ผ์„ ๋ฐ›์ง€ ์•Š์œผ๋ ค๋ฉด ml-dl-book-qn...@googlegroups.com์— ์ด๋ฉ”์ผ์„ ๋ณด๋‚ด์„ธ์š”.
์›น์—์„œ ์ด ํ† ๋ก ์„ ๋ณด๋ ค๋ฉด https://groups.google.com/d/msgid/ml-dl-book-qna/8ca506ae-ea92-4c41-9223-559c931fa59cn%40googlegroups.com์„(๋ฅผ) ๋ฐฉ๋ฌธํ•˜์„ธ์š”.
Reply all
Reply to author
Forward
0 new messages