Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerroth committed Apr 3, 2024
1 parent 5003259 commit 65e21be
Show file tree
Hide file tree
Showing 10 changed files with 1,077 additions and 908 deletions.
591 changes: 312 additions & 279 deletions research/fed-bpt/src/LMForwardAPI.py

Large diffs are not rendered by default.

44 changes: 29 additions & 15 deletions research/fed-bpt/src/cma_decomposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Type, Any

import copy
import numpy as np
from nvflare.app_common.decomposers.common_decomposers import NumpyArrayDecomposer, Float64ScalarDecomposer
from nvflare.fuel.utils import fobs
from nvflare.fuel.utils.fobs import Decomposer
from nvflare.fuel.utils.fobs.datum import DatumManager
from typing import Any, Type

import cma
from cma import CMAOptions, CMADataLogger
import numpy as np
from cma import CMADataLogger, CMAOptions
from cma.constraints_handler import BoundNone
from cma.evolution_strategy import _CMAParameters, _CMASolutionDict_functional, _CMAStopDict
from cma.optimization_tools import BestSolution
from cma.recombination_weights import RecombinationWeights
from cma.sampler import GaussFullSampler
from cma.sigma_adaptation import CMAAdaptSigmaCSA
from cma.transformations import GenoPheno, DiagonalDecoding
from cma.utilities.utils import SolutionDict, BlancClass, DictFromTagsInString, ElapsedWCTime, MoreToWrite
from cma.transformations import DiagonalDecoding, GenoPheno
from cma.utilities.utils import BlancClass, DictFromTagsInString, ElapsedWCTime, MoreToWrite, SolutionDict

from nvflare.app_common.decomposers.common_decomposers import Float64ScalarDecomposer, NumpyArrayDecomposer
from nvflare.fuel.utils import fobs
from nvflare.fuel.utils.fobs import Decomposer
from nvflare.fuel.utils.fobs.datum import DatumManager


class GaussFullSamplerDecomposer(Decomposer):
Expand Down Expand Up @@ -82,11 +82,25 @@ def register_decomposers():
fobs.register(Float64ScalarDecomposer)
fobs.register(GaussFullSamplerDecomposer)
fobs.register(CMADataLoggerDecomposer)
fobs.register_data_classes(cma.CMAEvolutionStrategy, CMAOptions, GenoPheno,
SolutionDict, BoundNone, _CMAParameters, RecombinationWeights,
CMAAdaptSigmaCSA, DiagonalDecoding, _CMASolutionDict_functional,
BestSolution, BlancClass, CMADataLogger, DictFromTagsInString,
ElapsedWCTime, _CMAStopDict, MoreToWrite)
fobs.register_data_classes(
cma.CMAEvolutionStrategy,
CMAOptions,
GenoPheno,
SolutionDict,
BoundNone,
_CMAParameters,
RecombinationWeights,
CMAAdaptSigmaCSA,
DiagonalDecoding,
_CMASolutionDict_functional,
BestSolution,
BlancClass,
CMADataLogger,
DictFromTagsInString,
ElapsedWCTime,
_CMAStopDict,
MoreToWrite,
)


register_decomposers()
Expand Down
Loading

0 comments on commit 65e21be

Please sign in to comment.