Is there any way to treat multicollinearity between two variables in dataset? - python-3.x

I am doing regression problem where I have to predict weekly sales of 45 outlet of a departmental store. I have a variable named temperature(values in Celsius) and I want to do feature engineering on this column as a practice so I came with the the idea of creating another column which will also be a temperature column but values will be in farenhite which will be derived from celsius column, but that will lead to multicollinearity between these two variable, Is there any way to treat multicollinearity between two variable or should I go with another approach?

Related

Calculate risk using Cox model coefficients and mean values

I'm trying to understand the example presented in Appendix C here
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6481149/
Equation C1 is clear to me.
But in Equation C2 they use the mean values.
Such mean values are clear to me in the case of categorical variables for example 1.548 is the mean value of the Sex variable (as shown in the Table 3). Please correct me if I'm wrong.
But in numerical variables I don't understand which mean values are they using. For example for the Age variable they use 3.768, if I understand right, that value is the log of the mean age, should be log(44.15)=1.64. Instead the used value is 3.768.
Please could anybody clarify where does this value come from?
In statistics log often means the natural logarithm, sometimes denoted ln. The four values they take the logarithms of are:
Variable
Reported Mean
ln(Mean)
Reported
Age
44.15
3.788
3.768
BMI
25.61
3.243
3.230
BP Syst
138.6
4.932
4.913
Pulse Rate
75.61
4.326
4.311
The calculated values are not exactly equal to the reported values. But it looks close enough that this is probably the calculation they used. Without the data and/or code they used it's hard to say why the results are different. The study mentions excluding 130 participants because of ethics protections. So, perhaps one table was calculated using a slightly different group of participants than the other table?

Which is the best Data Mining model to extrapolate known values to missing values in a table? (General question)

I am working on a little data mining project (I am still a Data Science student, not a professional). Maybe you can help me to choose a proper model for my task.
So, let's say we have a table with three columns and around 4000 rows:
YEAR
COLOR
NAME
1900
Green
David
1901
Yellow
Sarah
1902
Green
???
1902
Red
Sarah
…
…
…
2020
Purple
John
Any value for any field can be repeated in the dataset (also Year values).
In the first two columns we don't have missing values, but we only have around 20% of Name values in the third column. Name value deppends somewhat on the first two columns (not a causal relation).
My goal is to extrapolate the available Name values to the whole table and get a range of occurrences for each name value (for example in a boxplot)
I have imagined a process like that, although I am not very sure if statitically it makes sense (any objections and suggestions are appreciated):
For every unknown NAME value, the algorythm choose randomly one of the already known NAME values. The odds of a particular NAME value to be chosen depend on the variables YEAR and COLOR. For instance, if 'David' values tend to be correlated with low Year values AND with 'Green' or 'Purple' values for Color, the algorythm give 'David' a higher probability to be chosen if input values for Year and Color are "1900, Purple".
When the above process ends, the number of occurrences for each name is counted.
The above process is applied 30 times and the results for each name are displayed in a plotbox.
However, I don't know which is the best model to implement an idea similar to this. I have drawn the process in a simple paint drawing:
Possible output for the task
Which do you think it could be a good approach to this task? I appreciate any help.
I think you have the process down, it's converting the data which may be the first hurdle.
I would look at using from sklearn.preprocessing import OrdinalEncoder to encode the data to convert from categorical to numeric.
You could then use a random number generator to produce a number within the range defined by the encoding which would randomly select a name.
Loop through this 30 times with an f loop to achieve the result.
It also looks like you will need to provide the ranking values for year and colour prior to building out your code. From here you would just provide bands, for example, if year > 1985, etc within your for loop to specify the names.

What test can I use to calculate significance of optimization lift?

Given the following data for 12 users:
username, number of deals for control, revenue from test, revenue from control
Here's an example of how the data looks like
Can you help me figure out how I can calculate the significance of the hypothesis that the test is more profitable (preferably using excel)?
The measure I was thinking of using was the % of lift in revenues for each customer.
P.s. I have a background in statistics but not an expert so please keep it as simple as possible.
Since each pair of incomes refers to the same individual, you can perform a paired t-test.
Variable 1: Control income
Variable 2: Deals income
Then follow these instructions (copied here for posterity):
In Excel, click Data Analysis on the Data tab.
From the Data Analysis popup, choose t-Test: Paired Two Sample for Means.
Under Input, select the ranges for both Variable 1 and Variable 2.
In Hypothesized Mean Difference, you’ll typically enter zero. This value is the null hypothesis value, which represents no effect. In
this case, a mean difference of zero represents no difference between
the two methods, which is no effect.
Check the Labels checkbox if you have meaningful variables labels in row 1. This option helps make the output easier to interpret. Ensure
that you include the label row in step #3.
Excel uses a default Alpha value of 0.05, which is usually a good value. Alpha is the significance level. Change this value only when
you have a specific reason for doing so.
Click OK.
Alternatively, you can indeed calculate the difference between the two incomes, and then perform a one sample t-test (assuming that the difference is zero). However, such a test is not available out-of-the-box in Excel; the procedure is described here.

Python based multi-label Classification

I have a data set something like shown below which in real scenario wil have row count something between 10000 to 1000000.
There would be more columns but the core problem revolves round these two fields.
Known Labels
I have known categories -'Apple', 'Blueberry','Orange','Lettuce'
Dataset
DataFrame
({'ROWID':1,2,3,4,5,6,7,8,9,10],
'Category':'Apple','Blueberry'.'Orange','Lettuce','Fruit','Salad','xyz','Fruit'
,'Leaf','Avocado'],
'Details':['Eat one a day ,doctors keep away','Like it in a muffin',
'Tastes yummy','Like it with
salmon','Glass of a juice','Ceser dressing on lettuce','Nothing in my
basket','Like it in a muffin','I like it it with salami','Comes from
Mexico']})
Problem:
I have to create one or many metrics using groupby on category
When the category column has unknown cell value I need to read the text from the 'Details' and predict the best suited label for category.
For example
Salad ->Lettuce, Fruit(Row#5)-> Orange Fruit(Row#8)-> Blueberry
Leaf(Row#9)-> 'Lettuce' It is understood that some of the rows can
not be categorized.
Help Needed:
I am a newbie in data science algorithm, looking for some guidance to identify the right model to solve the problem.
Use Naive Bayes for the Details column, before that do a simple filtering on the Category column and remove rows having known category values.

How automatically to identify series when creating graph

Right now I have three columns of data that I would need on a graph. It's about the score of different countries on non-related evaluations. So there's a column for the year of the evaluation, the name of the country and the score it got.
Since there are hundreds of them, it would take a lot of time to add data series individually, so I was wondering if isn't there a way to just select the columns and Excel could identify each series automatically.
Illustrating:
Supposing I had this table:
And wanted to create a graph like this:
Is there a way to do this easily?
Plot a PivotChart Line type: Years for ROWS, Country for COLUMNS and Sum of Score for VALUES.

Resources