ltfmselector 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ltfmselector/env.py CHANGED
@@ -364,6 +364,7 @@ class Environment:
364
364
  # Get number of total recruited features
365
365
  nFSubset = (self.get_feature_mask()).sum()
366
366
 
367
+ # DEV:: If more than 10 statements, implement dictionary instead
367
368
  if self.fQueryFunction == "step":
368
369
  return self.get_fQueryCostStep(nFSubset)
369
370
  elif self.fQueryFunction == "linear":
@@ -380,17 +381,26 @@ class Environment:
380
381
 
381
382
  def get_fQueryCostLinear(self, _nFSubset):
382
383
  '''Linear function for querying feature'''
383
- return max(
384
+ _qC = max(
384
385
  self.fQueryCost,
385
386
  self.fQueryCost + self.fRate*(_nFSubset-self.fThreshold)
386
387
  )
388
+ if not self.fCap is None:
389
+ return min(self.fCap, _qC)
390
+ else:
391
+ return _qC
387
392
 
388
393
  def get_fQueryCostQuadratic(self, _nFSubset):
389
394
  '''Quadratic function for querying feature'''
390
395
  if _nFSubset > self.fThreshold:
391
- return self.fQueryCost + self.fRate*(_nFSubset-self.fThreshold)**2
396
+ _qC = self.fQueryCost + self.fRate*(_nFSubset-self.fThreshold)**2
392
397
  else:
393
- return self.fQueryCost
398
+ _qC = self.fQueryCost
399
+
400
+ if not self.fCap is None:
401
+ return min(self.fCap, _qC)
402
+ else:
403
+ return _qC
394
404
 
395
405
  def get_feature_mask(self):
396
406
  '''
@@ -128,10 +128,11 @@ class LTFMSelector:
128
128
  increases
129
129
 
130
130
  fCap : None or float
131
- If `fQueryFunction == {'step'}`, upper limit of penalty
131
+ If `fQueryFunction == {'step', 'linear', 'quadratic'}`, upper
132
+ limit of penalty
132
133
 
133
134
  fRate : None or float
134
- If `fQueryFunction == {'linear', 'quadratic', 'exponential'}`, rate
135
+ If `fQueryFunction == {'linear', 'quadratic'}`, rate of
135
136
  individual cost functions
136
137
 
137
138
  mQueryCost : float
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ltfmselector
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Locally-Tailored Feature and Model Selector with Deep Q-Learning
5
5
  Project-URL: GitHub, https://github.com/RenZhen95/ltfmselector/
6
6
  Author-email: RenZhen95 <j-liaw@hotmail.com>
@@ -0,0 +1,9 @@
1
+ ltfmselector/__init__.py,sha256=lf3e90CNpEDvEmNZ-0iuoHOPsA7D-WN_opbBsTYLVEA,76
2
+ ltfmselector/env.py,sha256=F0NycqUkNn-p2zC1EPdds73__G8yyMW5f9F93yPDHTA,16371
3
+ ltfmselector/ltfmselector.py,sha256=GdxazN6JG_ELZ7a7x6bbBCVDsgmdRWOsbi-TnRFNk8Y,32354
4
+ ltfmselector/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ ltfmselector/utils.py,sha256=VXYZSDm7x4s0p9F_58NLW8WQa3dxi0vHZewRy6miC2E,5438
6
+ ltfmselector-0.2.1.dist-info/METADATA,sha256=mHEsAKWtYYsGOQyRxHX5f8fAaSXePDDklL_CLzMay9A,3020
7
+ ltfmselector-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
8
+ ltfmselector-0.2.1.dist-info/licenses/LICENSE,sha256=tmIDlkkp4a0EudXuGmeTdGjHjPhmmXkEMshACXLqX2w,1092
9
+ ltfmselector-0.2.1.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- ltfmselector/__init__.py,sha256=lf3e90CNpEDvEmNZ-0iuoHOPsA7D-WN_opbBsTYLVEA,76
2
- ltfmselector/env.py,sha256=898o_g6-i0Rz5R-4WxZInf3xaxXHf58kPJId0KeewQM,16070
3
- ltfmselector/ltfmselector.py,sha256=zxGTLtuaoqdWbGxM8JmQES1_kGpNad1utRfDkepPoko,32329
4
- ltfmselector/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- ltfmselector/utils.py,sha256=VXYZSDm7x4s0p9F_58NLW8WQa3dxi0vHZewRy6miC2E,5438
6
- ltfmselector-0.2.0.dist-info/METADATA,sha256=76QDgOBLL81otMAwr9D-eNfviT5SY76Tf70-WNGIgyg,3020
7
- ltfmselector-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
8
- ltfmselector-0.2.0.dist-info/licenses/LICENSE,sha256=tmIDlkkp4a0EudXuGmeTdGjHjPhmmXkEMshACXLqX2w,1092
9
- ltfmselector-0.2.0.dist-info/RECORD,,