Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
declearn2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magnet
DecLearn
declearn2
Commits
fae6f6e6
Commit
fae6f6e6
authored
5 months ago
by
ERRAJI Brahim
Browse files
Options
Downloads
Patches
Plain Diff
Fixing a math bug
parent
0823b2aa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
declearn/training/_manager.py
+7
-6
7 additions, 6 deletions
declearn/training/_manager.py
with
7 additions
and
6 deletions
declearn/training/_manager.py
+
7
−
6
View file @
fae6f6e6
...
@@ -508,7 +508,7 @@ class TrainingManager_FOG(TrainingManager):
...
@@ -508,7 +508,7 @@ class TrainingManager_FOG(TrainingManager):
):
):
self
.
n_clients
=
len
(
obj_gaps_clients
)
#This is m - 1 to devide lambda as in algo FOG
self
.
n_clients
=
len
(
obj_gaps_clients
)
#This is m - 1 to devide lambda as in algo FOG
self
.
r_j
=
obj_gaps_clients
self
.
r_j
=
obj_gaps_clients
def
get_obj_gaps_other_client
(
def
get_obj_gaps_other_client
s
(
self
,
self
,
):
):
return
self
.
r_j
return
self
.
r_j
...
@@ -533,8 +533,8 @@ class TrainingManager_FOG(TrainingManager):
...
@@ -533,8 +533,8 @@ class TrainingManager_FOG(TrainingManager):
w_i
=
1.0
w_i
=
1.0
else
:
else
:
loss_i
=
nsmp
=
0.0
loss_i
=
nsmp
=
0.0
BATCH_SIZE
=
self
.
train_data
.
get_data_specs
().
n_samples
bs
=
self
.
train_data
.
get_data_specs
().
n_samples
for
batch
in
self
.
train_data
.
generate_batches
(
batch_size
=
BATCH_SIZE
):
for
batch
in
self
.
train_data
.
generate_batches
(
batch_size
=
bs
):
y_true
,
y_pred
,
s_wght
=
self
.
model
.
compute_batch_predictions
(
batch
)
y_true
,
y_pred
,
s_wght
=
self
.
model
.
compute_batch_predictions
(
batch
)
s_loss
=
self
.
model
.
loss_function
(
y_true
,
y_pred
)
s_loss
=
self
.
model
.
loss_function
(
y_true
,
y_pred
)
if
s_wght
is
None
:
if
s_wght
is
None
:
...
@@ -544,10 +544,11 @@ class TrainingManager_FOG(TrainingManager):
...
@@ -544,10 +544,11 @@ class TrainingManager_FOG(TrainingManager):
loss_i
+=
(
s_wght
*
s_loss
).
sum
()
loss_i
+=
(
s_wght
*
s_loss
).
sum
()
nsmp
+=
s_wght
.
sum
()
nsmp
+=
s_wght
.
sum
()
loss_i
/=
nsmp
loss_i
/=
nsmp
r_i
=
loss_i
-
self
.
L_i_theta_s
w_i
=
0.0
w_i
=
0.0
for
loss
_j
in
self
.
get_obj_gaps_other_client
():
for
r
_j
in
self
.
get_obj_gaps_other_client
s
():
w_i
+=
(
loss
_i
-
loss
_j
)
w_i
+=
(
r
_i
-
r
_j
)
w_i
=
1
+
(
4
*
(
self
.
lmbda
/
self
.
n_clients
)
*
w_i
)
w_i
=
1
+
(
4
*
self
.
lmbda
*
w_i
)
*
(
1
/
self
.
n_clients
)
gradients
=
self
.
model
.
compute_batch_gradients
(
batch
)
gradients
=
self
.
model
.
compute_batch_gradients
(
batch
)
updates
=
self
.
optim
.
compute_updates_from_gradients
(
self
.
model
,
gradients
)
updates
=
self
.
optim
.
compute_updates_from_gradients
(
self
.
model
,
gradients
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment