@@ -16,7 +16,7 @@ def __init__(
1616 Initialize the float codec with a PyFloatCodec instance.
1717 :param codec: An instance of PyFloatCodec.
1818 """
19- self .codec = self ._create_encoding (encoding , use_numpy )
19+ self .codec = self .__create_encoding (encoding , use_numpy )
2020
2121 def encode (self ) -> Genotype [float ]:
2222 """
@@ -35,7 +35,7 @@ def decode(self, genotype: Genotype[float]) -> T:
3535 raise TypeError ("genotype must be an instance of Genotype." )
3636 return self .codec .decode_py (genotype = genotype .__backend__ ())
3737
38- def _create_encoding (
38+ def __create_encoding (
3939 self , encoding : FloatEncoding , use_numpy : bool
4040 ) -> PyFloatCodec :
4141 """
@@ -124,20 +124,21 @@ def matrix(
124124 Create a matrix codec with specified rows and columns.
125125 Args:
126126 shape: A tuple (rows, cols) or a list of integers specifying the shape of the matrix.
127- value_range: Minimum and maximum value for the Gene's Allele to be init with.
128- bound_range: Minimum and maximum values the allele is allowed to be within during evolution
127+ init_range: Minimum and maximum value for the Gene's Allele to be init with.
128+ bounds: Minimum and maximum values the allele is allowed to be within during evolution.
129+ use_numpy: Whether or not to decode the Genotype into a numpy array.
129130 Returns:
130131 A new FloatCodec instance with matrix configuration.
131132
132133 Example
133134 --------
134135 Create a codec that will produce a Genotype with 2 Chromosomes both containing 3 FloatGenes
135136 Alleles between 0.0 and 1.0, and bounds between -1.0 and 2.0:
136- >>> rd.FloatCodec.matrix(shape=(2, 3), value_range =(0.0, 1.0), bound_range =(-1.0, 2.0))
137+ >>> rd.FloatCodec.matrix(shape=(2, 3), init_range =(0.0, 1.0), bounds =(-1.0, 2.0))
137138 FloatCodec(...)
138139
139140 The same can be achieved with a list of shapes:
140- >>> rd.FloatCodec.matrix(shape=[3, 3], value_range =(0.0, 1.0), bound_range =(-1.0, 2.0))
141+ >>> rd.FloatCodec.matrix(shape=[3, 3], init_range =(0.0, 1.0), bounds =(-1.0, 2.0))
141142 FloatCodec(...)
142143 """
143144 shapes = None
@@ -180,15 +181,16 @@ def vector(
180181 Create a vector codec with specified length.
181182 Args:
182183 length: Length of the vector.
183- value_range: Minimum and maximum value for the Gene's Allele to be init with.
184- bound_range: Minimum and maximum values the allele is allowed to be within during evolution.
184+ init_range: Minimum and maximum value for the Gene's Allele to be init with.
185+ bounds: Minimum and maximum values the allele is allowed to be within during evolution.
186+ use_numpy: Whether or not to decode the Genotype into a numpy array.
185187 Returns:
186188 A new FloatCodec instance with vector configuration.
187189
188190 Example
189191 --------
190192 Create a FloatCodec that will encode a Genotype with a single Chromosome containing 5 FloatGenes
191- >>> rd.FloatCodec.vector(length=5, value_range =(0.0, 1.0), bound_range =(-1.0, 2.0))
193+ >>> rd.FloatCodec.vector(length=5, init_range =(0.0, 1.0), bounds =(-1.0, 2.0), use_numpy=False )
192194 FloatCodec(...)
193195 """
194196 if length <= 0 :
@@ -222,16 +224,16 @@ def scalar(
222224 """
223225 Create a scalar codec.
224226 Args:
225- value_range : Minimum and maximum value for the Gene's Allele to be init with.
226- bound_range : Minimum and maximum values the allele is allowed to be within during evolution.
227+ init_range : Minimum and maximum value for the Gene's Allele to be init with.
228+ bounds : Minimum and maximum values the allele is allowed to be within during evolution.
227229 Returns:
228230 A new FloatCodec instance with scalar configuration.
229231
230232 Example:
231233 --------
232234 Create a FloatCodec that will encode a Genotype with a single Chromosome containing a single FloatGene
233235 with Alleles between 0.0 and 1.0, and bounds between -1.0 and 2.0:
234- >>> rd.FloatCodec.scalar(value_range =(0.0, 1.0), bound_range =(-1.0, 2.0))
236+ >>> rd.FloatCodec.scalar(init_range =(0.0, 1.0), bounds =(-1.0, 2.0))
235237 FloatCodec(...)
236238 """
237239 if init_range is not None :
0 commit comments