Skip to main content

All Questions

Tagged with
1 vote
1 answer
206 views

Why does my PythonModel expect 3 arguments but only 2 are defined?

I try to create a PythonModel by creating a class log it using mlflow The class looks like: # Model wrapper class class ModelWrapper(mlflow.pyfunc.PythonModel): def __init__(self): self.generator = ...
RRO's user avatar
  • 13
0 votes
1 answer
41 views

Python issue with fitting a custom function containing double integrals

I want to fit some data using a custom function which contains a double integral. a,b, and c are pre-defined parameters, and alpha and beta are two angles on which the function must be integrated. ...
Lorenzo Metilli's user avatar
0 votes
2 answers
135 views

Correlation Function syntax

Hello, I'm attempting to develop a function that takes two expressions as inputs: the name of the platform (for instance, "PS2") and the kind of reviews (for instance, "critic score&...
Maor Ohayon's user avatar
1 vote
1 answer
135 views

Custom Function - string on Pandas columns

i am trying to apply the custome function on pandas dataframe and its not working. it giving me an error AttributeError: 'str' object has no attribute 'str' def f_MI(DF): if DF['AccNo'] == DF['...
kpra's user avatar
  • 23
0 votes
1 answer
1k views

Error Saving & Loading Tensorflow/Keras Model With Custom Classes/Functions

I recently created a Tensorflow/Keras model with Keras Transformers. To do this, the custom PositionalEmbedding & TransformerEncoder classes were created and used to build the model architecture. ...
Sam Skinner's user avatar
0 votes
1 answer
80 views

Write a function in Python to group by and generate a boxplot in python

Python novice here, In the dataframe below, I need assistance writing a function that does the following: I: select columns year,state,dept, revenue(mil) II: boxplot of revenue(mil) ~ dept for each ...
RayX500's user avatar
  • 277
0 votes
0 answers
274 views

Make custom function with if-statement

I'm tring to make function with if statement. I want to change whichever df that is longer to sample to the other shorter df's length. But it doesn't work, throwing an error 'list index out of range'. ...
dkdlfls26's user avatar
  • 171
1 vote
1 answer
260 views

Pandas Custom Cumulative Calculation Over Group By in DataFrame

I am trying to run a simple calculation over the values of each row from within a group inside of a dataframe, but I'm having trouble with the syntax, I think I'm specifically getting confused in ...
devjunkie's user avatar
0 votes
1 answer
91 views

Pandas custom function

I have a pandas dataframe like this: Cust_ID PROD_ID Quantity Price Quantity Price Quantity Price 31-12-2020 31-12-2020 01-01-2021 01-01-2021 02-01-2021 02-01-2021 123 abc 10 5 10 5.4 11 6 123 efg 50 ...
Poulos Spyros's user avatar
0 votes
2 answers
269 views

Defining a function in SymPy that takes a list as argument

I'm currently building a "formula editor" in a GUI application in python. I use sympy to parse and check the validity of the typed formula, based on a dictionary of subs. No problem with ...
zigma12's user avatar
  • 321
0 votes
1 answer
749 views

Custom function with multiple argument and one return value in map_fn for tensor object in Tensorflow

I have two tensors t1 and t2 (shape=(64,64,3), dtype=tf.float64). I want to execute a custom function "func" which takes two tensors as input and returns one new tensor. @tf.function def ...
Imranur Rahman's user avatar
0 votes
0 answers
1k views

Create Custom Loss Function in Catboost

I´m trying to create a customized loss function to use in Catboost. This is the function that I'm trying to implement: class ErrorLoss(object): def calc_ders_range(self, approxes, targets, weights)...
adriii's user avatar
  • 15
0 votes
1 answer
47 views

Assigning a file to a list

I have a program where I must store a file (included below) once the user specifies the name of the file. Then I must organize the contents of the file into a list and sift through the "survey ...
Lissette Zena's user avatar
2 votes
1 answer
410 views

LightGBMRegressor Custom eval loss fuction return as list error for single output

I want to use custom eval function in my lightGBM model. My code is as follow: X = df.loc[:, "VALUE_1":"TVALUE_33"] y_true = df.loc[:, "VALUE_34"] X_train, X_test, ...
betd1's user avatar
  • 81
0 votes
2 answers
1k views

Python: Custom print function that prints function text

Python script: text = "abcde" print("text[::-1] : ", text[::-1]) print("text[5:0:-1] : ", text[5:0:-1]) Output: text[::-1] : edcba text[5:0:-1] : edcb Can a custom ...
user avatar

15 30 50 per page