I have this portion of a data-set, where the y values eventually must reach an asymptotic limit. Here is a plot of the first 300 entries:

I have seen asymptotic regression (of the form y = b0 + b1*(1-exp(-exp(lrc) * x)) and I think it would be the best model to fit this data. R seemingly already has the function in its libraries, but I cannot find one in Python.

(1) Is there any library function for asymptotic regression or relevant saturation dynamics models as answered by Cleb below? If not, how to model it using scipy.optimize.curve_fit?

(2) Also how to predict the maximum integer value of the curve? Example, If y=2454.1234 is the value at X=10**20 and y=2545.5678 at X=10**50, for a certain model, I want to obtain 2454. Is there any one-shot way, other than linear search?

Mar 14, 2022 1,315 views

## 1 answer to this question.

If the problem persists, try using a checkpoints file that has been updated with the newest code.

The output will be like this:

The Code is given below:

import numpy as np
Import pandas as pd
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

def fun(x, a, b, n):
return a * x ** n / (x ** n + b)
y = df['y'].astype(float)
x = df['X'].astype(float)
popt, pcov = curve_fit(f, x, y, p0=[1800., 20., 1.])
plt.scatter(x, y)
plt.plot(x, f(x, *popt), 'r-')
plt.show()

• 6,000 points

## Difference between classification and regression score in Python scikit learn

Classification Score is used for discrete values ...READ MORE

## Linear regression with gradient descent to predict house prices using area (one var) in python

Apart from instructional purposes, I'm not sure ...READ MORE

## Efficient online linear regression algorithm in python

To calculate 10k rows, and also to speed ...READ MORE

## Controlled Variables in Logistic Regression in Python

Control variables, as you may know, are ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE