# Import necessary libraries
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
# Generate some sample data
X = np.random.rand(100, 5)
y = 2*X[:,0] + 3*X[:,1] - 4*X[:,2] + np.random.randn(100)*0.5
# Create a pipeline with scaling and linear regression
pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('regressor', LinearRegression())])
# Fit the pipeline to the data
pipeline.fit(X, y) 

import pickle
# Save the model to a file
with open('model.pkl', 'wb') as f:
    pickle.dump(pipeline, f)
# Load the model from the file
with open('model.pkl', 'rb') as f:
    pipeline = pickle.load(f)
    X_testpred = np.random.rand(5)
    y_testpred = pipeline.predict([X_testpred])
    print("Predicted value:",y_testpred)