Skip to content

Commit 946e862

Browse files
Update README.md
1 parent 1a39a40 commit 946e862

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ Initial **smooth** function is as following (the same as it is in approximation
116116
<br/>**f(x) = sin(x / 5) * exp(x / 10) + 5 * exp(-x / 2)**
117117

118118
Finding minimum of **smooth** function with **'BFGS'** method with start point **2**
119-
<br/><br/>Part of the code is shown below:
120-
119+
<br/>Part of the code is shown below:
121120
```py
122121
# Setting initial point in form of 'ndarray' as 'minimize' function requires it in form of 'ndarray'
123122
x0_start = np.array([2])
@@ -129,9 +128,8 @@ y0_min = optimize.minimize(f_array, x0_start, method='BFGS')
129128
print(y0_min) # fun = 1.7452682903449388, iterations = 6
130129
```
131130

132-
Finding minimum of **smooth** function with **'BFGS'** method with start point **30**
133-
<br/><br/>Part of the code is shown below:
134-
131+
<br/>Finding minimum of **smooth** function with **'BFGS'** method with start point **30**
132+
<br/>Part of the code is shown below:
135133
```py
136134
# Setting initial point in form of 'ndarray' as 'minimize' function requires it in form of 'ndarray'
137135
x1_start = np.array([30])
@@ -143,9 +141,8 @@ y1_min = optimize.minimize(f_array, x1_start, method='BFGS')
143141
print(y1_min) # fun = -11.898894665981285, iterations = 6
144142
```
145143

146-
Finding minimum of **smooth** function with **'differential evolution'** method in range [1, 30]
147-
<br/><br/>Part of the code is shown below:
148-
144+
<br/>Finding minimum of **smooth** function with **'differential evolution'** method in range [1, 30]
145+
<br/>Part of the code is shown below:
149146
```py
150147
# Setting the range for searching in form of tuple inside list as function requires it
151148
x2_range = [(1, 30)] # tuple inside list
@@ -154,18 +151,16 @@ y2_min = optimize.differential_evolution(f_array, [(1, 30)])
154151
print(y2_min) # fun = -11.89889467, iterations = 5
155152
```
156153

157-
Initial **non-smooth** function is takeen as an integer results of smooth function defined above:
158-
<br/>**h(x) = int(f(x))**
154+
<br/>Initial **non-smooth** function is takeen as an integer results of smooth function defined above: **h(x) = int(f(x))**
159155
<br/>Part of the code is shown below:
160156
```py
161157
# By using 'np.int_' we return 'numpy.ndarray' of integer numbers
162158
def h_array(k):
163159
return np.int_(f_array(k))
164160
```
165161

166-
Finding minimum of **non-smooth** function with **'BFGS'** method with start point **30**
167-
<br/><br/>Part of the code is shown below:
168-
162+
<br/>Finding minimum of **non-smooth** function with **'BFGS'** method with start point **30**
163+
<br/>Part of the code is shown below:
169164
```py
170165
# Setting initial point in form of 'ndarray' as 'minimize' function requires it in form of 'ndarray'
171166
x3_start = np.array([30])
@@ -177,9 +172,8 @@ y3_min = optimize.minimize(h_array, x3_start, method='BFGS')
177172
print(y3_min) # fun = -5, iterations = 0
178173
```
179174

180-
Finding minimum of **non-smooth** function with **'differential evolution'** method in range [1, 30]
181-
<br/><br/>Part of the code is shown below:
182-
175+
<br/>Finding minimum of **non-smooth** function with **'differential evolution'** method in range [1, 30]
176+
<br/>Part of the code is shown below:
183177
```py
184178
# Setting the range for searching in form of tuple inside list as function requires it
185179
x4_range = [(1, 30)] # tuple inside list
@@ -188,7 +182,7 @@ y4_min = optimize.differential_evolution(h_array, [(1, 30)])
188182
print(y4_min) # fun = -11.0, iterations = 3
189183
```
190184

191-
Full code is available here: [Function_Optimization.py](https://github.com/sichkar-valentyn/Machine_Learning_in_Python/tree/master/Codes/Function_Optimization.py)
185+
<br/>Full code is available here: [Function_Optimization.py](https://github.com/sichkar-valentyn/Machine_Learning_in_Python/tree/master/Codes/Function_Optimization.py)
192186

193187
Results are plot in order to understand the difference in finding minimums in smooth and non-smooth functions. Figure is shown below:
194188

0 commit comments

Comments
 (0)