Categories

## Find 3 numbers that are sum up to a given number

I need to create a recursive method that takes a number as input that will be the sum and find all the options to add three native numbers so they will be equal to this number. e.g if the input is 5, I will need to find all the 5 options [(1,1,3),(1,2,2),(1,3,1),(2,2,1),(3,1,1)]. max number is […]

Categories

## R Plot Bars are disappearing in grid.arrange/plot_grid

I have a problem with bars from my plots disappearing when I combine multiple plots. Here is the code I´m using: station<-c("Eins", "Zwei", "Drei","Vier") x1<-c(200, 185, 165,180) x2<-c(185,150,148,25) x3<-c(156,125,141,36) test.data<-data.frame(station,x1,x2,x3) plot_sof<-ggplot(test.data, aes(x=station, y=x1)) plot_sof + geom_bar(stat="identity",na.rm=TRUE) plot_sof_1<-ggplot(test.data, aes(x=station, y=x2)) plot_sof_1+geom_bar(stat = "identity",na.rm=TRUE) plot_sof_2<-ggplot(test.data, aes(x=station, y=x3)) plot_sof_2+geom_bar(stat = "identity",na.rm=TRUE) plot_grid(plot_sof, plot_sof_1, plot_sof_2, labels=c("x1", "x2", "x3")) grid.arrange(plot_sof, […]

Categories

## reverse the scale of the test outcome in the LSTM

I am using standardized predictors in training set to train an LSTM model. After I predict the outcome in test set, I need to reverse the predicted score back to the original scale. Normally I could just use the predicted score * SD of the trainning outcome + MEAN of the training outcome to reverse […]

Categories

## Set one element of each float4 in an array using CUDA/thrust

I have a fairly standard float4 class and an array of said float4s on the GPU. Each float4 represents an (x,y,z,rgba) point, and I’d like to use thrust to set the rgba value for each float4 in my array to a specific value. Seems like thrust::fill() might work with a custom iterator, but I don’t […]

Categories

## Simultaneously elastic net regressions

I’m trying to perform Elastic Net in R for multiple variables at the same time. I have 15 Xi and I want to find the elastic net model with the use of each variable as regressor. For one Xi I can perform the following and obtain optimal alpha and lambda with the following A<-matrix(rnorm(36),nrow=10,ncol = […]

Categories

## How to use back scale the coefficient after feature normalization in Multivariate Linear Regression

I have written below python code to find function of Multivariate Linear Regression using gradient descent. I have used feature normalization on input features and able to come up with w1,w2,w0 that minimize the loss. However, these number of w1,w2,w0 are the weights calculated after the x1, x2, and y are normalized. My goal is […]

Categories

## Get bus error after replacing stp with str in glibc’s aarch64 memcpy.S

For some reasons, I need to replace memcpy’s stp instruction with str, here is what I did: modified sysdeps/aarch64/memcpy.S @@ -102,11 +102,19 @@ ENTRY (MEMCPY) tbz tmp1, 5, 1f ldp B_l, B_h, [src, 16] ldp C_l, C_h, [srcend, -32] – stp B_l, B_h, [dstin, 16] – stp C_l, C_h, [dstend, -32] + //stp B_l, B_h, […]

Categories

## Using shortest path pgr_dijkstra

Versions PostGIS Bundle 3 for PostgreSQL x64 12 pgAdmin 4.24 pgrouting 3.1.0 I have also enabled the postgis and pgrouting extensions on a public schema. I am only just starting with pgrouting so I am new to all the concepts. I am trying to follow a tutorial from pgrouting.org to find the shortest path between […]

Categories

## convert List to data table in R with Binary entries (0 or 1)

I have a list as below: list("X1", c("X1", "X2"), "X3") I want to transform this list to data table as follows: The columns in data table will be as per all the unique entries in the list. In this example, the data frame will have columns – X1, X2, X3 The data table will have […]

Categories

## Problem with Standart Deviation calculation

I have this code where two evaluations about an employee are inserted by the user (organized in struct), I need to calculate the standard deviation and the variance between them. But it’s not working. What should I do? typedef struct info { char name[30]; float x1, x2; float aveg; float sum; }emp; float resultVar(emp aveg, […]