Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
636bc2c2
Commit
636bc2c2
authored
May 03, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some change
parent
d94862d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
neutralize.py
alphamind/data/neutralize.py
+4
-3
No files found.
alphamind/data/neutralize.py
View file @
636bc2c2
...
@@ -40,7 +40,7 @@ def neutralize(x: np.ndarray, y: np.ndarray, groups: np.ndarray=None, output_exp
...
@@ -40,7 +40,7 @@ def neutralize(x: np.ndarray, y: np.ndarray, groups: np.ndarray=None, output_exp
for
curr_idx
in
groups_ids
:
for
curr_idx
in
groups_ids
:
curr_x
=
x
[
curr_idx
]
curr_x
=
x
[
curr_idx
]
curr_y
=
y
[
curr_idx
]
curr_y
=
y
[
curr_idx
]
b
=
ls_fit
(
x
[
curr_idx
],
y
[
curr_idx
]
)
b
=
ls_fit
(
curr_x
,
curr_y
)
res
[
curr_idx
]
=
ls_res
(
curr_x
,
curr_y
,
b
)
res
[
curr_idx
]
=
ls_res
(
curr_x
,
curr_y
,
b
)
if
output_exposure
:
if
output_exposure
:
for
i
in
range
(
exposure
.
shape
[
2
]):
for
i
in
range
(
exposure
.
shape
[
2
]):
...
@@ -83,8 +83,9 @@ def ls_res(x: np.ndarray, y: np.ndarray, b: np.ndarray) -> np.ndarray:
...
@@ -83,8 +83,9 @@ def ls_res(x: np.ndarray, y: np.ndarray, b: np.ndarray) -> np.ndarray:
@
nb
.
njit
(
nogil
=
True
,
cache
=
True
)
@
nb
.
njit
(
nogil
=
True
,
cache
=
True
)
def
ls_explain
(
x
:
np
.
ndarray
,
b
:
np
.
ndarray
)
->
np
.
ndarray
:
def
ls_explain
(
x
:
np
.
ndarray
,
b
:
np
.
ndarray
)
->
np
.
ndarray
:
explained
=
np
.
zeros
(
x
.
shape
+
(
b
.
shape
[
1
],))
n
=
b
.
shape
[
1
]
for
i
in
range
(
b
.
shape
[
1
]):
explained
=
np
.
zeros
(
x
.
shape
+
(
n
,))
for
i
in
range
(
n
):
explained
[:,
:,
i
]
=
b
[:,
i
]
*
x
explained
[:,
:,
i
]
=
b
[:,
i
]
*
x
return
explained
return
explained
...
...
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