I have the following code and I obtain ‘TypeError: ‘tuple’ object is not callable'(in new_time) but I dont understand why. I wrote it based on this tutorial https://jalammar.github.io/a-visual-guide-to-using-bert-for-the-first-time/ and https://github.com/getalp/Flaubert My code : #torch == 1.8.1 #numpy == 1.20.2 #pandas == 1.0.3 #transformers == 4.6.1 from transformers import logging logging.set_verbosity_warning() import numpy as np import ..

#### Category : numpy

I have a directory with the following subdirectories |—Data | |—Notebooks The Data directory contains csv files, while the Notebooks directory contains my Jupyter notebook files. How do I access the file from the Data directory with a notebook at the Notebooks directory? My initial idea was this: df = pd.read_csv(‘../Data/csvFile’) However the code block ..

I’m working on a physics simulation where particles collide together and I need to calculate the resulting velocities of the particles after the collision. For that, the following formulas are given (I have to use these, I’ve found other equations online which caused me different problems): I’ve tried to recreate them like this: def reflect_particle_velocity(Pa, ..

I would like to split both, my x and y data into their respective ratios. I created a function called Split that does the splitting: def Split (datax, datay, train_ratio, validate_ratio): xtrain, xvalidate, xtest = np.split(datax, [int(train_ratio*len(datax)), int(validate_ratio*len(datax))]) ytrain, yvalidate, ytest = np.split(datay, [int(train_ratio*len(datay)), int(validate_ratio*len(datay))]) Then, when I call the function as follows and print ..

I have a 2D numpy array that looks like this: a = np.array([[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]) And a 1D list that looks like this: b = [4, 3, 2, 3, 4] I’d like to ..

I have 3 classifiers that run over 288 samples. All of them are sklearn.neural_network.MLPClassifier structures. Here is the code i am using: list_of_clfs = [MLPClassifier(…), MLPClassifier(…), MLPClassifier(…)] probas_list = [] for clf in list_of_clfs: probas_list.append(clf.predict_proba(X_test)) Each predict_proba(X_test) will return a 2D array with shape (n_samples, n_classes). Then, i am creating a 3D array that will ..

I have data that is being returned by some functions and I need to collect it all, preferably by creating this new function to do so, into either a dataframe with two columns or a numpy array with two columns. For example, I am running other functions multiple times that return a number each time ..

I’m using the webbased Jupyter Notebook. I’ve been getting this import error, so I checked the provided link, decided to reinstall Numpy. ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or ..

This code is ok in matlab but in python it does not worked and not plotted curves that calculated for r=(ri/1000, ri/100, ri/10) Actually it just plotted last values. How can I plot curves for all ri values? I dont want to use for import matplotlib.pyplot as plt import numpy as np t = np.arange(263, ..

I have a concave hull (not convex) that I have the points for eg: A,B,C,D,E. I’ve gotten the pairs of points that make up the outer edges. [A,B],[A,E],[C,D],[B,C],[E,D]. (This is a very simplified version) I want to get the connected points in order (CW or CCW doesn’t matter) so I can use them as a ..

## Recent Comments