Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ying-Qiu Zheng
archive
Commits
1ab9e709
Commit
1ab9e709
authored
Jul 01, 2021
by
Ying-Qiu Zheng
Browse files
Update 2021JUN20.md
parent
3c80e712
Changes
1
Hide whitespace changes
Inline
Side-by-side
2021JUN20.md
View file @
1ab9e709
...
...
@@ -46,14 +46,14 @@ d = 1500 # number of features
# generate feature matrices - high quality
Xtrain
,
Xtest
=
(
randn
(
n
,
d
)
for
_
∈
1
:
2
)
# low quality -- some columns are noisier
noise_col
=
rand
(
1
:
d
,
Int
(
d
*
0.2
))
# 20% of the columns are noiser
noise_col
=
rand
(
1
:
d
,
Int
(
d
*
0.2
))
# 20% of the columns
of XL
are noiser
XLtrain
=
copy
(
Xtrain
)
XLtrain
[
:
,
noise_col
]
.+=
randn
(
n
,
Int
(
d
*
0.2
))
XLtest
=
copy
(
Xtest
)
XLtest
[
:
,
noise_col
]
.+=
randn
(
n
,
Int
(
d
*
0.2
))
[
x
.=
exp
.
(
x
)
for
x
∈
[
Xtrain
,
Xtest
,
XLtrain
,
XLtest
]]
# generate high quality coefficients - 60% of the coefficients are zeros.
# generate high quality coefficients - 60% of the coefficients
w
are zeros.
w
=
randn
(
d
);
w
[
rand
(
1
:
d
,
Int
(
d
*
0.6
))]
.=
0.
ytrain
=
logistic
.
(
Xtrain
*
w
);
ytest
=
logistic
.
(
Xtest
*
w
)
...
...
@@ -61,7 +61,7 @@ ttrain = [x > 0.5 ? 1 : 0 for x in ytrain]
ttest
=
[
x
>
0.5
?
1
:
0
for
x
in
ytest
]
# low quality -- some columns are zero
zero_col
=
rand
(
1
:
d
,
Int
(
d
*
0.05
))
# 5% of the columns are zero
zero_col
=
rand
(
1
:
d
,
Int
(
d
*
0.05
))
# 5% of the columns
in XL
are zero
[
x
.=
exp
.
(
x
)
for
x
∈
[
Xtrain
,
Xtest
]]
XLtrain
=
copy
(
Xtrain
)
XLtrain
[
:
,
zero_col
]
.=
0.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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