Category : numpy

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 ..

Read more

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 ..

Read more

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, ..

Read more

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 ..

Read more

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 ..

Read more

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 ..

Read more