Skip to content

Commit 38df47c

Browse files
authored
Merge pull request #1 from edumgt/copilot/validate-ml-python-files
fix: correct logic errors and code quality issues across ML example files
2 parents 12bffe3 + 04c2e9b commit 38df47c

6 files changed

Lines changed: 8 additions & 7 deletions

File tree

FeatureSample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
documents = [
55
"나는 인공지능을 공부하고 있다",
66
"인공지능은 미래의 핵심 기술이다",
7-
"인공지능 우리의의 핵심 기술이다",
8-
"인공지능 기술을 선도하는 기업업",
7+
"인공지능은 우리의 핵심 기술이다",
8+
"인공지능 기술을 선도하는 기업",
99
"자연어 처리는 인공지능의 한 분야다"
1010
]
1111

HouseSample.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
import pandas as pd
32
from sklearn.model_selection import train_test_split
43
from sklearn.linear_model import LinearRegression
@@ -8,7 +7,7 @@
87
data = pd.DataFrame({
98
'면적': [50, 70, 80, 100, 120, 150, 180, 200, 250, 300],
109
'방 개수': [5, 5, 1, 1, 1, 5, 5, 6, 6, 7],
11-
'가격': [3000, 5000, 5500, 7000, 8500, 11000,
10+
'가격': [3000, 5000, 5500, 7000, 8500, 11000,
1211
13000, 15000, 18000, 22000] # 단위: 만 원
1312
})
1413

ImageMasking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
highlighted[mask == 1] = 255 # 밝은 값으로 변경
2929

3030
# 4. 시각화
31-
fig, axs = plt.subplots(1, 3, figsize=(4, 12))
31+
fig, axs = plt.subplots(1, 3, figsize=(12, 4))
3232
axs[0].imshow(image, cmap='gray')
3333
axs[0].set_title("원본 이미지")
3434
axs[1].imshow(mask, cmap='gray')

LinearSample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33

44
# 입력: 공부 시간 (X), 출력: 시험 점수 (y)
5-
X = np.array([[3], [2], [1], [4], [5]]) # 공부 시간
5+
X = np.array([[1], [2], [3], [4], [5]]) # 공부 시간
66
y = np.array([55, 60, 65, 70, 75]) # 시험 점수
77

88
model = LinearRegression()

SvmSample.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
y_pred = model.predict(X_test)
2525
acc = accuracy_score(y_test, y_pred)
2626

27+
2728
# 시각화
2829
def plot_classification(X, y, clf):
2930
h = 0.02
@@ -41,4 +42,5 @@ def plot_classification(X, y, clf):
4142
plt.ylabel("Feature 2")
4243
plt.show()
4344

45+
4446
plot_classification(X, y, model)

Word2Vec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
]
1414

1515
# Word2Vec 모델 학습
16-
model = Word2Vec(sentences=sentences, vector_size=100,
16+
model = Word2Vec(sentences=sentences, vector_size=100,
1717
window=5, min_count=1, workers=4)
1818

1919
# 학습된 단어 목록 확인

0 commit comments

Comments
 (0)