Categories
Mastering Development

Normalise a dataframe in R

I have a dataframe named examples with some semantic features occurences: > str(examples) Classes ‘spec_tbl_df’, ‘tbl_df’, ‘tbl’ and ‘data.frame’: 50 obs. of 12 variables: $ filename : chr “Text01” “Text02” “Text03” “Text04” … $ Control : num 1 3 0 0 0 6 0 1 0 1 … $ Economic : num 1 3 0 […]

Categories
Ask Mathematics

Adaptive weighted sum

I have a optimization problem with two objectives (Expressed as one) : \begin{equation} minimize : Weight_1(\sum_{t=1}^{T}\sum_{i=1}^{N}\sum_{j=1}^{N} T_{ijt}) + Weight_2( \sum_{t=1}^{T}\sum_{i=1}^{N} I_{it}) \end{equation} Where $T_{ijt}$ is the number of setups of a machine from product $i$ to $j$ in period $t$ and $I_{it}$ is the inventory level at each period. The weighting parameters are unknown and […]

Categories
Development

Two-Way Repeated Measures ANOVA: Error in lm.fit()… 0 non-na cases (rstatix)

I am trying to run a Two-Way Repeated Measures ANOVA using the R Statix package based on the description from here however I am running into the subject error with my dataset. The data consist of 10 replicate biomass measurements recorded at each of 8 Locations across 5 months (10 reps x 8 locations x […]

Categories
Development

How to cycle through permutations of a list of 88 elements?

I’m trying to assign a single variable each permutation of a list of 88 elements one after another. This means the variable would be re-assigned a new permutation 88! times. I have tried making 88 nested for-loops but apparently there is a limit to how many for-loops you can nest. I am using Python. elements […]

Categories
Development

How to minimize the sum of the elements in the final array after performing k number of operation

This question is asked in my interview coding and there were 12 test cases and i am only able to pass 8 of them. minSum(List values, int k) method need to complete. Example : nums = [10,20,7] and k=4 ans answer for this array is 5+5+4=14. Each operation consists of removing element from the array, […]

Categories
Development Python

Parsing a .pdb file in Python and creating a dictionary for specific record types

First, let me start by saying that I’m doing this as a Python exercise and I’m not allowed to use Biopython. I am writing a script that will help me parse any .pdb file generated from a trajectory. I am trying to create a dictionary that would link the chain variable with the resNumber variable. […]

Categories
Development Python

How to fix Python Gekko Max Equation Length error

My code work on small variables. But when I do in 128*128 array of variables, the error below is appearing: APM model error: string > 15000 characters Consider breaking up the line into multiple equations The may also be due to only using newline character CR instead of CR LF (for Windows) or LF (for […]

Categories
Development

Query to calculate difference between time only for that particular Date

following are the sample data from table Station ([ID], [Area], [Time_Stamp], [Error], [E_Value]) VALUES (201, ‘hlpw1’, ‘2019-10-02 06:10:00’, ‘Error 1 Value 1’, 186), (202, ‘hlpw1’, ‘2019-10-02 06:30:00’, ‘Error 1 Value 2’, 78), (203, ‘hlpw1’, ‘2019-10-02 06:55:00’, ‘Error 1 Value 3’, 229), (204, ‘hlpw1’, ‘2019-10-02 07:10:00’, ‘Error 1 Value 4’, 175), (205, ‘hlpw1’, ‘2019-10-02 07:40:00’, ‘Error […]

Categories
Development

How to get extremes from already determined groups of peak/valley indexes? [python]

I’m sorry if i’m butchering the question but essentially i have 3 arrays. One array which is the signal data, and an array of peak indexes and an array of valley indexes. The problem however is that sometimes there will be multiple indexes for a peak in a row before there is a valley index. […]

Categories
Development

Combine blocks of different images and produce a new image

I have six photographs. I changed them into block structure. Consider an image of size 200×200. 1. I converted into blocks of 10×10 so now I have 400 blocks in total each of size 10×10. I did this for each image. 2. Then I found the mean value for each block. Again for all images. […]