Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: How to use scipy.optimization.brute for multivariable function
Post: RE: How to use scipy.optimization.brute for multiv...
Your function seems to be quite simple and you can probably try to find out extreme points by differentiating it.
If the function is monotonic within the area of interest, it reaches its extremal va... |
|
scidam |
General Coding Help |
9 |
5,209 |
Oct-28-2020, 10:40 PM |
|
|
Thread: change numerical values to categorical names
Post: RE: change numerical values to categorical names
How can we help, if there is no code except the dictionary?
If you use pandas, you can do it easily, e.g.
In [75]: import pandas as pd
...:
...: mapper = {1: 'John', 2: 'July'}
...:
.... |
|
scidam |
General Coding Help |
3 |
2,570 |
Oct-25-2020, 11:22 PM |
|
|
Thread: How to use scipy.optimization.brute for multivariable function
Post: RE: How to use scipy.optimization.brute for multiv...
This is because brute use int32 dtype for X. Just append dots to grid definition, e.g. grid = ((10.0, 40.0, 1.0), (10.0, 40.0, 1.0)). However, there are still large values occur when evaluating fT. Al... |
|
scidam |
General Coding Help |
9 |
5,209 |
Oct-25-2020, 11:12 PM |
|
|
Thread: Buliding a dataframe with where conditions
Post: RE: Buliding a dataframe with where conditions
If you need to choose rows by condition use loc instead:
df = df.loc[filter_1 & filter_2] |
|
scidam |
Data Science |
2 |
1,585 |
Oct-23-2020, 11:44 PM |
|
|
Thread: iteration
Post: RE: iteration
The error was raised because the length of the list was changed. This is usually bad practice to iterate over changing list (using for-loop). However, I don't completely understand the problem. Are y... |
|
scidam |
Data Science |
2 |
1,491 |
Oct-23-2020, 11:28 PM |
|
|
Thread: dataframe groupby with totals for certain fields
Post: RE: dataframe groupby with totals for certain fiel...
Quote:, and I was told that if you're looping then most of the times you're probably doing it wrong
In this case loop doesn't apply to all dataframe, you just iterate over column names... Loops are a... |
|
scidam |
Data Science |
4 |
2,197 |
Oct-23-2020, 05:41 AM |
|
|
Thread: Interpolating DataFrame method=‘index’ help
Post: RE: Interpolating DataFrame method=‘index’ help
You can set index, perform interpolation and drop the index:
merged.set_index('Z').interpolate(method='index').reset_index() |
|
scidam |
Data Science |
1 |
1,589 |
Oct-22-2020, 12:48 AM |
|
|
Thread: Iterate through dataframe to extract delta of a particular time period
Post: RE: Iterate through dataframe to extract delta of ...
Since rows corresponds days you can just shift the data frame on 6 positions and compute difference between shifted and original ones:
(df.shift(6).iloc[:, 1] - df.iloc[:,1])[df.index % 6 == 0].dropn... |
|
scidam |
Data Science |
1 |
1,438 |
Oct-22-2020, 12:19 AM |
|
|
Thread: Explain Me Neural Network Ai's
Post: RE: Explain Me Neural Network Ai's
It seems that the question is about reinforcement learning and, as a particular, deep Q-learning. However, the game playing strategy depends on the game: you can define a good strategy using if/elif c... |
|
scidam |
Data Science |
2 |
1,700 |
Oct-22-2020, 12:17 AM |
|
|
Thread: How to use scipy.optimization.brute for multivariable function
Post: RE: How to use scipy.optimization.brute for multiv...
It seems that f(x, y) returns too large values. Could you provide implementation of f(x, y) here? Actually, this is not an error, just a warning. |
|
scidam |
General Coding Help |
9 |
5,209 |
Oct-21-2020, 11:44 PM |
|
|
Thread: How to use scipy.optimization.brute for multivariable function
Post: RE: How to use scipy.optimization.brute for multiv...
You are right. (1, ) is a value assigned to T (parameter). Note, that brute expects that the first argument of a function responsive for optimization domain. However, this first argument can be a vect... |
|
scidam |
General Coding Help |
9 |
5,209 |
Oct-20-2020, 10:27 AM |
|
|
Thread: How to use scipy.optimization.brute for multivariable function
Post: RE: How to use scipy.optimization.brute for multiv...
You need to define ranges where brute will search for an optimum, e.g.
grid = ((-1, 1, 0.1), (-1, 1, 0.1))
# Also, you can use slice objects for this:
# grid = (slice(-1, 1, 0.1), slice(-1, 1, 0.1))... |
|
scidam |
General Coding Help |
9 |
5,209 |
Oct-19-2020, 10:08 PM |
|
|
Thread: Multi Select from SQL
Post: RE: Multi Select from SQL
Is the database really huge? What happened if you try to retrieve all elements, e.g. pd.read_sql_query('select * from your_db')... It is hard to answer questions dealing with external resources... How... |
|
scidam |
General Coding Help |
6 |
2,107 |
Oct-19-2020, 12:35 AM |
|
|
Thread: dataframe groupby with totals for certain fields
Post: RE: dataframe groupby with totals for certain fiel...
Your for-loop iterates over two items (or a few number of columns)... I don't understand why it is expensive (probably, copying and concatenating huge df's are expensive).
Alternative way is to calcul... |
|
scidam |
Data Science |
4 |
2,197 |
Oct-19-2020, 12:21 AM |
|
|
Thread: What would be a substitute for "::"
Post: RE: What would be a substitute for "::"
If slicing is allowed for the object, you can use it directly, e.g.:
'a string'[slice(None, None, 2)] |
|
scidam |
Homework |
1 |
1,275 |
Oct-10-2020, 11:21 PM |
|
|
Thread: Remove specific elements from list with a pattern
Post: RE: Remove specific elements from list with a patt...
Try the following:
>>> N = 9
>>> sum([list(range(i, j)) for i, j in zip([4*k+1 for k in range(N)][1::2], [4*k + 5 for k in range(N)][1::2])], [])
[5, 6, 7, 8, 13, 14, 15, 16, 21, 22,... |
|
scidam |
General Coding Help |
3 |
2,285 |
Oct-10-2020, 11:15 PM |
|
|
Thread: Web app structure with python as backend
Post: RE: Web app structure with python as backend
(Oct-06-2020, 07:44 AM)alt19 Wrote: As I'm more interested in backend I wanted to use free templates for fronted.
1. Is there any source where I can find such free templates [HTML+CSS+JS]?
I would b... |
|
scidam |
Web Scraping & Web Development |
1 |
1,633 |
Oct-06-2020, 11:28 PM |
|
|
Thread: Creating Plots & Sharing X Axis
Post: RE: Creating Plots & Sharing X Axis
Did you try .twinx axes method?
ax1 = ax0.twinx()
ax1.plot(...) # ax0 and ax1 share x-axis. |
|
scidam |
General Coding Help |
2 |
1,617 |
Oct-05-2020, 01:46 AM |
|
|
Thread: Creating symbolic matrix automated
Post: RE: Creating symbolic matrix automated
It seems to be Vandermonde matrix, take a look at vander function from NumPy. |
|
scidam |
General Coding Help |
2 |
1,818 |
Oct-05-2020, 01:42 AM |
|
|
Thread: Graph identifier
Post: RE: Graph identifier
I would do the following:
1) build interpolated (e.g. bezier interpolation) curves;
2) subsample interpolated curves: from this we would have data1 = [(x1, y1), ..., (xN, yN)] and data2 = [(p1, q1), .... |
|
scidam |
General Coding Help |
4 |
2,296 |
Oct-04-2020, 01:25 PM |