Mapping a set of input variables to a single output variable; also optimization of input (ex. Car inputs to fuel economy)
I'm wondering what are the stateoftheart methods when having to learn the mapping between a set of input variables to a single output. An example is the inputs of a car to fuel efficiency where the data set contained these variables:
 Time and Date
 Speed (Kph)
 Rpm
 Car tire pressure (psi)
 Fuel Economy (Liters/gallon)
(I understand the data set is lacking and flawed. But this is just an example.)
Most cases use multiple linear regressions to do this.
Some also use a basic neural network with an input, hidden, and output layer could be used to solve this problem.The input is a m x n array (where m is the number of data points and n is the number of variables (in the above case, 3). And the output is a single variable representing fuel economy. You then compare the predicted fuel economy to the actual and begin optimizing the neural network (back propagation). However I learned that from a relatively old source (2013). I was wondering if there have been new advancements in solving this kind of problem.
Can RNNs (LSTMs) be used to solve this? If the data is measured every minute for example, I have reason to believe that the current fuel economy is affected by the previous car inputs (t1, t2, etc.)
I also learned that I can use evolutionary algorithms to optimize this sort of problem. (ex. Whats the fastest I can go while having a fuel economy of 50 L/gal). What are the most popular evolutionary algorithms for this kind of problem? Could anyone recommend any papers or other material that could help me learn more about this?
See also questions close to this topic

Optimizing a benchmark test function using NelderMead algorithm
i wrote a NelderMead algorithm for minimizing a non constrained optimization problemobjective function]1 this test function is very similar to Biggs_EXP5 function except it does not have the power 2. my NM algorithm is getting stuck in the Shrink step and i don't have any idea where and how to select the initial point and how to get near the global minimum. anyone knows what's the problem? i'll appreciate any help from you.

Multiparameter constraint minimization in R
I am trying to figure out if it is possible to use R to perform a minimization with with multiple constraints. Where the constraints do not have a closed form.
In a nutshell, I have a set of random numbers (generated with fixed seeds). I have also defined a function, say f(theta) that will take a vector consisting of model parameters and transform my original set of random numbers into a random sample from the defined distribution.
I am trying to find a set of parameters such that when fed into f will resulting in a sample that will have the 2.5th, 5th, 10th percentile less than or equal to a set targets while minimizing the difference between the target and actual values.

Getting Information about Optimal Solution from Multidimensional Knapsack Algorithm
I am building a multidimensional knapsack algorithm to optimize fantasy NASCAR lineups. I have the code thanks to another author and am now trying to piece back together the drivers the optimal solution consists of. I have written code to do this in the standard case, but am struggling to figure it out with the added dimension. Here's my code:
#open csv file df = pd.read_csv('roster_kentucky_july18.csv') print(df.head()) def knapsack2(n, weight, count, values, weights): dp = [[[0] * (weight + 1) for _ in range(n + 1)] for _ in range(count + 1)] for z in range(1, count + 1): for y in range(1, n + 1): for x in range(weight + 1): if weights[y  1] <= x: dp[z][y][x] = max(dp[z][y  1][x], dp[z  1][y  1][x  weights[y  1]] + values[y  1]) else: dp[z][y][x] = dp[z][y  1][x] return dp[1][1][1] w = 50000 k = 6 values = df['total_pts'] weights = df['cost'] n = len(values) limit_fmt = 'Max value for weight limit {}, item limit {}: {}' print(limit_fmt.format(w, k, knapsack2(n, w, k, values, weights)))
And my output:
Driver total_pts cost 0 A.J. Allmendinger 29.030000 6400 1 Alex Bowman 39.189159 7600 2 Aric Almirola 53.746988 8800 3 Austin Dillon 32.476250 7000 4 B.J. McLeod 14.000000 4700 Max value for weight limit 50000, item limit 6: 325.00072048
I'm looking to at least get the "cost" associated with each "total_pts" in the optimal solution, though it would be nice if I could have it draw out the "Driver" column of the dataframe instead (which I guess could be accessed by indices). Thanks.

How to train a machine learning algorithm to find this pattern: x1 < x2 without generating a new feature (e.g. x1x2) first?
If I had 2 features x1 and x2 where I know that the pattern is:
if x1 < x2 then class1 else class2
How can I train a machine learning algorithm to find such a pattern?
I know that I could create a third feature x3 = x1x2. Then feature x3 can easily be used by some machine learning algorithms. For example a decision tree can solve the problem 100% using x3 and just 3 nodes (1 decision and 2 leaf nodes).
But, is it possible to solve this without creating new features?
I tried MLP and SVM with different kernels, including svg kernel and the results are not great. This seems like a problem that should be easily solved 100% if a machine learning algorithm could only find such a pattern.
As an example of what I tried, here is the scikitlearn code where the SVM could only get a score of 0.992:
import numpy as np from sklearn.svm import SVC # Generate 1000 samples with 2 features with random values X_train = np.random.rand(1000,2) # Label each sample. If feature "x1" is less than feature "x2" then label as 1, otherwise label is 0. y_train = X_train[:,0] < X_train[:,1] y_train = y_train.astype(int) # convert boolean to 0 and 1 svc = SVC(kernel = "rbf", C = 0.9) # tried all kernels and C values from 0.1 to 1.0 svc.fit(X_train, y_train) print("SVC score: %f" % svc.score(X_train, y_train))
Output running the code:
SVC score: 0.992000
This is an oversimplification of my problem. The real problem may have hundreds of features and different patterns, not just x1 < x2. However, to start with it would help a lot to know how to solve for this simple pattern.

Best Machine Learning Algorithm to Rank Top 10 Items Based on Different Attributes?
I am working on a project where I want to retrieve top n selections from a dataset based on different attributes. Let's say I am looking for the best store to buy a product. The algorithm will take in location, prices, closing/opening times, and return policy, and whether they have the product. It will return the top n (let's say 10) stores out of the dataset that it has found.
I want to know what the best machine learning algorithm is for this scenario.

How to consider word pairs/phrases for Word2Vec and other preprocessing
So it's my first time using Word2Vec and Im using a wikipedia dump with WikiCorpus to preprocess the file before training my Word2Vec model. I want to use the following preprocessing techniques:
 Convert all letters to lowercase (I think WikiCorpus does this already).
 Remove all punctuation (Done by WikiCorpus).
 Consider word pairs/phrases as a single word, for example 'Big Apple' > 'big_apple', not 'big', 'apple'.
 Convert all digits to their word forms, so '3' > 'three'
At the moment I have no idea how to do the last two. I know about num2text but not sure how to incorporate with WikiCorpus or Word2vec. Can anyone help?

How to judge learning rate of the generator and discriminator of DCGAN?
I am building the DCGAN to generate 3D model, based on the code (https://github.com/meetshah1995/tf3dgan). However, when I try to generate the model based on my own examples, the results look wried. The losses on both generator and discriminator are fluctuating significantly. The real data is the 3D binary voxelization data, but the output is some small values around 0 (The ideal value should be around 0.5), can anyone explain me how to set the initial learning rate or judge the network?

Why my code is running slower in GOOGLE COLAB than in my notebook?
I'm beginning to learn how to use Google Colab and in my first test (using Python 3) the code below executed a lot faster im my computer than in Colaboratory(GPU), and i imagine thre's something really wrong.
Here's what i'm doing:
MY COMPUTER with a CPU i572000U (2.5Gh) i installed tensorflow for CPU. The execution time was 65 seconds.
COLABORATORY modified the runtime tipe to GPU and loaded necessary file (.csv with 24kb with colab upload). It took 261 seconds.
I would really apreciate some help to understand what is wrong, maybe something with my code ?
from keras.models import Sequential #camadas sequenciais from keras.layers import Dense import numpy import time import pydot as pydot from keras.utils.vis_utils import plot_model numpy.random.seed(7) #carregar arquivo dataset = numpy.loadtxt("pimaindiansdiabetes.data.csv", delimiter=",") start_time = time.process_time() #dividir entre variaveis de ENTRADA(X) e SAIDA(Y) X = dataset[:,0:8] Y = dataset[:,8] #cria modelo model = Sequential() #adiciona uma camada com 12 neuronios e 8 entradas model.add(Dense(12, input_dim=8, activation='relu')) #rectifier como funcao de ativacao #segunda camada com 8 neuronios model.add(Dense(8, activation='relu')) #camada final para classificar model.add(Dense(1, activation='sigmoid')) #configurar o processo de aprendizagem model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) #treinar o modelo model.fit(X, Y, epochs=500, batch_size=10, verbose=0) #avaliar o modelo scores = model.evaluate(X, Y) print("\n%s: %.2f%%" % (model.metrics_names[1], scores[1]*100)) #testar modelo predections = model.predict(X) rounded = [round(x[0]) for x in predections] print(time.process_time()  start_time, "seconds")

Plotting 3d data distribution of a set of Images
I am working on Generative Adversarial Networks. I learned that GAN's learn to transform simple Gaussian distribution to Complex distribution similar to training data. I visualized how the Distribution of noise looks, but I want to visualize the distribution of my Training set, like in this image:
please tell me how I can do this in Python ?

Use variables to get lmList() in R
I have data that I read in as a data.table. It would look something like this:
d < data.table(TYPE = c('A', 'A', 'A', 'B', 'B', 'C', 'C'), CLASS = c(1, 2, 3, 1, 4, 2, 1), NUM = c(48, 23, 32, 56, 75, 45, 76))
If I run
fits < lmList(NUM ~ TYPE  CLASS, data = d)
it runs, however, if I try to store the column names into variables (to reduce hard coding) and run it like this:Y < 'NUM' X < 'TYPE' grp < 'CLASS' fits < lmList(Y ~ X  grp, data = d)
I get this error:
Warning messages: 1: In storage.mode(v) < "double" : NAs introduced by coercion 2: In lmList(Y ~ X  grp, data = d) : Fitting failed for 1 group(s), probably because a factor only had one level: contrasts can be applied only to factors with 2 or more levels
I also tried
fits < lmList(as.name(Y) ~ as.name(X)  as.name(grp), data = d)
and I get this error:Error in model.frame.default(formula = as.name(Y) ~ as.name(X) + as.name(grp), : object is not a matrix
What am I doing wrong here? Any help or advice is welcome. Thanks!
Update
Here is a link tolmList
for reference. 
Do I need to convert data values in my target variable to a common unit in regression analysis?
I have a data which has some features (some kind of products, country in which it is sold etc.) and a Target Variable (the product's price in the country's local currency). So, do I have to scale my Target variable with respect to one common currency for regression analysis?

linear_model.py:1283: RuntimeWarning: invalid value encountered in sqrt return rho, np.sqrt(sigmasq)
i have encountered a big problem when I do exercise of time series analysis with plot_ACF and plot_PACF.
when I run my code, it always gives me warning like this:
linear_model.py:1283: RuntimeWarning: invalid value encountered in sqrt
return rho, np.sqrt(sigmasq)
and I tried to find solution on Google, but found nothing helpful. Appreciation if someone could help me fix this warning. many many thx!
my coding environment: python 3.6.6 win64
statsmodels lib used in my laptop: statsmodels0.9.0cp36cp36mwin_amd64
and my source code is listed below:
import pandas as pd import numpy as np import matplotlib.pyplot as plt from statsmodels.graphics.tsaplots import plot_acf,plot_pacf dta=[10930,10318,10595,10972,7706,6756,9092,10551,9722,10913,11151,8186,6422, 6337,11649,11652,10310,12043,7937,6476,9662,9570,9981,9331,9449,6773,6304,9355, 10477,10148,10395,11261,8713,7299,10424,10795,11069,11602,11427,9095,7707,10767, 12136,12812,12006,12528,10329,7818,11719,11683,12603,11495,13670,11337,10232, 13261,13230,15535,16837,19598,14823,11622,19391,18177,19994,14723,15694,13248, 9543,12872,13101,15053,12619,13749,10228,9725,14729,12518,14564,15085,14722, 11999,9390,13481,14795,15845,15271,14686,11054,10395] dta_list = np.arange(2001,2091) data=pd.DataFrame(dta,index=dta_list) data.plot() plt.show() D_data=data.diff(1).dropna() D_data.plot() plt.show() plot_acf(D_data).show() plot_pacf(D_data).show()

Impact of fitness function domain selection in multiobjective evolutionary optimization
I am using evolutionary algorithms e.g. the NSGAII algorithm to solve unconstrained optimization problems with multiple objectives.
As my fitness functions sometimes have very different domains (e.g. f1(x) generates fitness values within [0..1] and f2(x) within [10000..10000000]) I am wondering if this has an effect on the search behaviour of the selected algorithm.
Does the selection of the fitness function domain (e.g. scaling all domains to a common domain from [lb..ub]) impact the solution quality and the speed of finding good solutions? Or is there no general answer to this question?
Unfortunately, I could not find anything on this topic. Any hints are welcome!

Population Markov Chain Monte Carlo Algorithm / Matlab
I'm looking for a matlab or python code for Population Markov Chain Monte Carlo Algorithm (PopMCMC) as described this paper, please help me. this is my first time I use this algorithm