Hot answers tagged

4

Hierarchical indices Have a look at here (scroll a bit underneath for the code)


3

For the Random Forests algorithm, the time complexity for building a complete un-pruned tree is $O(m.n\log(n))$, where $n$ is the number of records/instances and $m$ is the number of variables. The algorithm is embarrassingly parallel so in many cases companies with available resources will simply use sufficient compute nodes to enable the model to run in a ...


3

something like this might work: library(plyr) # initialize All_Data around here dlply(All_Data, 'Identifier', function(dataSubset) { g <- ggplot(dataSubset) + geom_point(mapping =aes(SampleDate, Total.Result)) + ylim(0,20000) file_name <- paste0("Scatter_", unique(dataSubset$Identifier), ".tiff", sep="") ggsave(file_name,g) }) (I didn't test ...


2

Some algorithms perform feature selection inherently - e.g. LASSO, random forests, and gradient-boosted models like XGBoost and LightGBM. If you are using those then there is no need for manual feature selection. However if you go down the feature selection route, it maybe good to start with features which have been suggested by all the approaches you have ...


2

There is a tradeoff between selecting features and precision. Fewer features probably have less precision (predictive power). Select the features that make sense for your problem taking into consideration the trade-off of information vs performance. The fewer features the model sees the predictive power that it has.


2

This has already been answered in stackoverflow here and here. The main idea is to create the formula from a string with as.formula: xnam <- paste("x", 1:25, sep="") fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+")))


1

If I understand right your question, you are looking to plot selected numerical columns against a selected categorical column of your dataset, am I right ? If so, you can have the use of dplyr, tidyr and ggplot2 packages to achieve this. Starting with this dataframe: id num1 num2 num3 cat cat2 1 C -0.48892284 1.417909 2.8884577 a ...


1

I have not been able to reproduce the blank model fit results. But, I know that the forecast function will only forecast up to known xreg inputs. For instance, your test period starts at 1/2019 and ends 12/2019 (12 periods) however you're attempting to forecast 72 periods. Try setting the h parameter in the forecast function equal to 12 and see if you get ...


1

You've given all four regions a dummy variable, so these are perfectly multicollinear, and the (unpenalized?) regression doesn't have a unique solution. R automatically drops a column in this situation and reports the NA. https://stats.stackexchange.com/q/212903/232706 https://stackoverflow.com/q/7337761/10495893 https://stats.stackexchange.com/q/25804/...


1

I finally figured out something that works: plot_list = list() for (i in Monitoring_Locations){ p = ggplot(All_Data) +geom_point(aes(SampleDate, Total.Result)) plot_list[[i]] = p } for (i in Monitoring_Locations) { file_name = paste("Scatter", i, ".tiff", sep="") tiff(file_name) print(plot_list[[i]]) dev.off() } The only ...


1

Given that the data is labeled, just perform supervised approaches, they will almost always beat unsupervised. Intuition why thats the case is because we dont have target function in unsupervised approach. In other words function that discriminates classes given our data set. I like to think that in unsupervised learning this function is identity function ...


1

For analysis of your clusters you can use the silhouette coefficient or silhouette width. These are available in cluster and factoextra package in R. I will explain what basically in silhouette analysis: The silhouette coefficient is calculated as follows: 1) For each observation i, it calculates the average dissimilarity between i and all the other ...


1

Looks like it requires R 3.6.0 or higher. At least that is what the docs here say.


Only top voted, non community-wiki answers of a minimum length are eligible