Skip to content

Commit

Permalink
fitfast() now defaults to minimum population of 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cjekel committed Mar 25, 2018
1 parent 66c0245 commit 9959ec2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Global optimization is used to find the best location for the user defined numbe
All other methods require the user to specify the specific location of break points, but in most cases the best location for these break points is unknown. It makes more sense to rather have the user specify the desired number of line segments, and then to quantitatively choose the best location for the ends of these line segments.

# Changelog
- 2018/03/25 Default now hides optimization results. Use disp_res=True when initializing piecewise_lin_fit to change.
- 2018/03/25 Default now hides optimization results. Use disp_res=True when initializing piecewise_lin_fit to change. The multi-start fitfast() function now defaults to the minimum population of 2.
- 2018/03/11 Added try/execpt behavior for fitWithBreaks function such that the function could be used in an optimzation routine. In general when you have a singular matrix, the function will now return np.inf.
- 2018/02/16 Added new fitfast() function which uses multi-start gradient optimization instead of Differential Evolution. It may be substantially faster for your application. Also it would be a good candidate if you don't need the best solution, but just a reasonable fit. Fixed bug in tests function where assert was checking bound, not SSr. New requirement, pyDOE library. New 0.1.0 Version.
- 2017/11/03 add setup.py, new tests folder and test scripts, new version tracking, initialize break0 breakN in the beginning
Expand Down
2 changes: 1 addition & 1 deletion pwlf/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.3
0.1.4
7 changes: 4 additions & 3 deletions pwlf/pwlf.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@ def fit(self, numberOfSegments, **kwargs):

return (self.fitBreaks)

def fitfast(self, numberOfSegments, pop=50, **kwargs):
def fitfast(self, numberOfSegments, pop=2, **kwargs):
# a function which uses multi start LBFGSB optimization to find the
# location of break points for a given number of line segments by
# minimizing the sum of the square of the errors.
#
# The idea is that we generate 50 random latin hypercube samples
# The idea is that we generate n random latin hypercube samples
# and run LBFGSB optimization on each one. This isn't guaranteed to
# find the global optimum. It's suppose to be a reasonable compromise
# between speed and quality of fit. Let me know how it works.
Expand All @@ -356,11 +356,12 @@ def fitfast(self, numberOfSegments, pop=50, **kwargs):
# returns the break points of the optimal piecewise continuous lines
#
#
# The default number of multi start optimizations is 50.
# The default number of multi start optimizations is 2.
# - Decreasing this number will result in a faster run time.
# - Increasing this number will improve the likelihood of finding
# good results
# - You can specify the number of starts using the following call
# - Minum value of pop is 2
#
# # finds 3 piecewise line segments with 30 multi start optimizations
# breaks = fitfast(3,30)
Expand Down

0 comments on commit 9959ec2

Please sign in to comment.