Description of the interpolate(scipy)



Python
library
pip

MeCab

numpy
digitize

mgrid

pad

polyfit

prod

shape

matplotlib
figure

pcolormesh

scatter

pytorch
BCELoss, MSELoss

device

Embedding

TensorDataset, Dataloader

RNN, LSTM
scikit-learn
SVC

scipy
interpolate
tkinter
postscript

image display

frame, grid

other
linear interpolation

OpenAI gym
CartPole-v0


Release date:2022/9/21         

In Japanese


■Description
Performs linear interpolation of array data.

■Example
<Case1>
For 1-dimensional array


import numpy as np
from scipy import signal, interpolate

x = np.array([1,2,5]) # X-axis
y = np.array([10,1,5]) # Y-axis
func = interpolate.interp1d(x,y) # Definition of linear interpolation function

a = np.array([1.5,4]) # Input

print(func(a)) # Output

 #[5.5 3.66666667]


<Case2>
For 2-dimensional array


x = np.array([1,3,5]) # X-axis
y = np.array([10,20,30]) # Y-axis
z = np.array([[1,2,3],[4,5,6],[7,8,9]]) # Z-axis
func = interpolate.interp2d(x,y,z) # Definition of linear interpolation function

a = 4 # Input value for X-axis
b = 15 # Input value for Y-axis

print(func(a,b)) # Output

 #[4. ]









List of related articles



Python
library
pip

MeCab

numpy
digitize

mgrid

pad

polyfit

prod

shape

matplotlib
figure

pcolormesh

scatter

pytorch
BCELoss, MSELoss

device

Embedding

TensorDataset, Dataloader

RNN, LSTM
scikit-learn
SVC

scipy
interpolate
tkinter
postscript

image display

frame, grid

other
linear interpolation

OpenAI gym
CartPole-v0