






"""simple docstring"""







import numpy as np

from transformers import Pipeline

def _a			(		_snake_case							):







      """simple docstring"""






      UpperCAmelCase          =	np.max(_snake_case				,	axis=-1				,	keepdims=_snake_case							)
      UpperCAmelCase          =	np.exp(outputs - maxes							)
      return shifted_exp / shifted_exp.sum(axis=-1				,	keepdims=_snake_case							)







class  lowerCamelCase__ (	snake_case			):






    def     _UpperCamelCase							(			self     ,**A ):
          UpperCAmelCase          =	{}
          if "second_text" in kwargs:
                UpperCAmelCase          =	kwargs["""second_text"""]
          return preprocess_kwargs, {}, {}






    def     _UpperCamelCase							(			self     ,A     ,A=None ):
          return self.tokenizer(A     ,text_pair=A     ,return_tensors=self.framework )






    def     _UpperCamelCase							(			self     ,A ):
          return self.model(**A )






    def     _UpperCamelCase							(			self     ,A ):
          UpperCAmelCase          =	model_outputs.logits[0].numpy()
          UpperCAmelCase          =	softmax(A )

          UpperCAmelCase          =	np.argmax(A )
          UpperCAmelCase          =	self.model.config.idalabel[best_class]
          UpperCAmelCase          =	probabilities[best_class].item()
          UpperCAmelCase          =	logits.tolist()
          return {"label": label, "score": score, "logits": logits}











"""simple docstring"""







import pandas as pd
from matplotlib import pyplot as plt
from sklearn.linear_model import LinearRegression

# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split

# Fitting Polynomial Regression to the dataset
from sklearn.preprocessing import PolynomialFeatures

# Importing the dataset
_UpperCamelCase					      =  pd.read_csv(
    """https://s3.us-west-2.amazonaws.com/public.gamelab.fun/dataset/"""
    """position_salaries.csv"""
)
_UpperCamelCase					      =  dataset.iloc[:, 1:2].values
_UpperCamelCase					      =  dataset.iloc[:, 2].values


_UpperCamelCase      ,  _UpperCamelCase      ,  _UpperCamelCase      ,  _UpperCamelCase					      =  train_test_split(X, y, test_size=0.2, random_state=0)


_UpperCamelCase					      =  PolynomialFeatures(degree=4)
_UpperCamelCase					      =  poly_reg.fit_transform(X)
_UpperCamelCase					      =  LinearRegression()
pol_reg.fit(X_poly, y)

def _a			(		):







      """simple docstring"""






      plt.scatter(_snake_case				,	_snake_case				,	color="""red"""							)
      plt.plot(_snake_case				,	pol_reg.predict(poly_reg.fit_transform(_snake_case							)							)				,	color="""blue"""							)
      plt.title("""Truth or Bluff (Linear Regression)"""							)
      plt.xlabel("""Position level"""							)
      plt.ylabel("""Salary"""							)
      plt.show()


if __name__ == "__main__":
  viz_polymonial()

  # Predicting a new result with Polymonial Regression
  pol_reg.predict(poly_reg.fit_transform([[5.5]]))
  # output should be 132148.43750003



