Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
YU Xiyue
AI_lab
Commits
8d216c19
Commit
8d216c19
authored
Jul 15, 2021
by
YU Xiyue
Browse files
linear classification
parent
1b80ee14
Changes
1
Hide whitespace changes
Inline
Side-by-side
src1/linearclassification.py
View file @
8d216c19
...
...
@@ -35,8 +35,9 @@ class LinearClassification:
lc
=
np
.
ones
([
train_features
.
shape
[
0
],
1
])
X
=
np
.
concatenate
((
lc
,
train_features
),
axis
=
1
)
N
=
train_features
.
shape
[
1
]
for
k
in
range
(
1
,
len
(
set
([
label
[
0
]
for
label
in
train_labels
]))
+
1
):
train_label
=
linear_label
([
label
[
0
]
for
label
in
train_labels
],
k
)
tl
=
[
label
[
0
]
for
label
in
train_labels
]
for
k
in
range
(
1
,
len
(
set
(
tl
))
+
1
):
train_label
=
linear_label
(
tl
,
k
)
w
=
np
.
zeros
([
1
,
N
+
1
])
for
n
in
range
(
self
.
epochs
):
y
=
np
.
dot
(
X
,
np
.
transpose
(
w
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment