<jupyter_start><jupyter_text>Tutorial Pipeline for Artifacts Generation, File Transfer<jupyter_code>import kfp
import typing<jupyter_output><empty_output><jupyter_text>Read the Data file from GCS Bucket<jupyter_code>#### Read the Data file from GCS Bucket## Read Data

from typing import NamedTuple
from kfp.components import *

def read_data(file_name: str, df_churn_op: OutputPath(), mlpipeline_ui_metadata: OutputPath()): 
        
    ## Import Required Libraries
    import pandas as pd
    import numpy as np
    import gcsfs
    from tensorflow.python.lib.io import file_io
    import json
    
    fs = gcsfs.GCSFileSystem(project='YDataSynthetic', token = 'cloud')

    df_churn = pd.read_csv(file_name)
    df_churn.to_csv(df_churn_op, index=False)
    
    df_disp = df_churn.iloc[0:5]
    df_disp = df_disp[['customerID','gender','tenure','Contract','TotalCharges','Churn']]
 
    df_disp.to_csv('gs://pipelines_artifacts/Artifacts/Data_Sample.csv', index=False)
    
    df_show = pd.read_csv("gs://pipelines_artifacts/Artifacts/Data_Sample.csv")
    categorical_cols = [c for c in df_show.columns if df_show[c].dtype == 'object' or c == 'SeniorCitizen']

    numerical_cols = ['tenure', 'MonthlyCharges', 'TotalCharges']

    schema = [{'name':c, 'type': 'CATEGORY'if c in categorical_cols else 'NUMBER'} for c in df_show.columns]
    
    metadata = {
        'outputs' : [{
          'type': 'table',
          'storage': 'gcs',
          'format': 'csv',
          'header': [x['name'] for x in schema],
          'source': 'gs://pipelines_artifacts/Artifacts/Data_Sample.csv'
        }
        ]
    }

    with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
        json.dump(metadata, f)

    with file_io.FileIO(mlpipeline_ui_metadata, 'w') as f:
        json.dump(metadata, f)
        
    
kfp_read_data = kfp.components.func_to_container_op(func = read_data, 
                                                          output_component_file = './read-data-func.yaml',
                                                          packages_to_install = ['numpy==1.17.2',
                                                                                 'pandas==1.0.3', 'gcsfs'])<jupyter_output><empty_output><jupyter_text>Statistical Analysis and Artifact Generation for Categorical Data Features<jupyter_code>def categorical_analysis(df_churn_ip :InputPath(), mlpipeline_ui_metadata: OutputPath(), df_churn_op :OutputPath()):
        
    ## Import Required Libraries
    import pandas as pd
    import numpy as np
    import gcsfs
    import seaborn as sns
    import matplotlib.pyplot as plt
    from sklearn.ensemble import RandomForestClassifier
    
    import warnings
    warnings.simplefilter(action='ignore', category=FutureWarning)
    warnings.simplefilter(action='ignore', category=UserWarning)
    
    import mpld3
    from tensorflow.python.lib.io import file_io
    import json

        
    fs = gcsfs.GCSFileSystem(project='YDataSynthetic', token = 'cloud')

    df = pd.read_csv(df_churn_ip)
    df1 = df.copy(deep=True)
    df1.to_csv(df_churn_op, index=False)

    sns.set(style="white")
    df['TotalCharges'] = df['TotalCharges'].replace(" ", 0).astype('float32')

    
    #Categorical Analysis


    def barplot_percentages(feature, orient='v', axis_name="percentage of customers"):
        ratios = pd.DataFrame()
        g = df.groupby(feature)["Churn"].value_counts().to_frame()
        g = g.rename({"Churn": axis_name}, axis=1).reset_index()
        g[axis_name] = g[axis_name]/len(df)
        if orient == 'v':
            ax = sns.barplot(x=feature, y= axis_name, hue='Churn', data=g, orient=orient, palette = 'bright')
            ax.set_yticklabels(['{:,.0%}'.format(y) for y in ax.get_yticks()])
        else:
            ax = sns.barplot(x= axis_name, y=feature, hue='Churn', data=g, orient=orient, palette = 'bright')
            ax.set_xticklabels(['{:,.0%}'.format(x) for x in ax.get_xticks()])
        ax.plot()


    #Paperless Billing
    
    df['churn_rate'] = df['Churn'].replace("No", 0).replace("Yes", 1)
    g = sns.FacetGrid(df, col="PaperlessBilling", height=4, aspect=.9)
    ax = g.map(sns.barplot, "Contract", "churn_rate", palette = "bright", order= ['Month-to-month', 'One year', 'Two year'])

    fig = plt.gcf()
    s = mpld3.fig_to_html(fig)

    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Graphs/Paperless_billing.html', 'w') as f:
        f.write(s)

    
    
    #Payments Method

    plt.figure(figsize=(9, 4.5))
    barplot_percentages("PaymentMethod", orient='v')

    fig = plt.gcf()
    s = mpld3.fig_to_html(fig)

    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Graphs/Payments_method.html', 'w') as f:
        f.write(s)


    #Generating Metadata
    metadata = {
        'version' : 1, 
        'outputs' : [{        
          'type': 'web-app',
          'storage': 'gcs',
          'source': "gs://pipelines_artifacts/Artifacts/Graphs/Paperless_billing.html",
        },
            {        
          'type': 'web-app',
          'storage': 'gcs',
          'source': "gs://pipelines_artifacts/Artifacts/Graphs/Payments_method.html",
        }
        ]
    }
    
    with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
        json.dump(metadata, f)

    with file_io.FileIO(mlpipeline_ui_metadata, 'w') as f:
        json.dump(metadata, f)


kfp_categorical_analysis = kfp.components.func_to_container_op(func = categorical_analysis, 
                                                          output_component_file = './categorical_analysis.yaml',
                                                          packages_to_install = ['gcsfs', 'scikit-learn==0.22.2',
                                                                                 'numpy==1.17.2',
                                                                                 'pandas==1.0.3',
                                                                                 'seaborn==0.9.0',
                                                                                 'matplotlib==3.1.1',
                                                                                 'mpld3==0.5.1'])<jupyter_output><empty_output><jupyter_text>Combined Statistical Analysis and Artifact Generation for Numerical and Categorical Features<jupyter_code>def mixed_analysis(df_churn_ip :InputPath(), df_churn_ip2 :InputPath(), 
                   mlpipeline_ui_metadata: OutputPath(), df_churn_op :OutputPath()):
        
    ## Import Required Libraries
    import pandas as pd
    import numpy as np
    import gcsfs
    import seaborn as sns
    import matplotlib.pyplot as plt
    from sklearn.ensemble import RandomForestClassifier
    
    import warnings
    warnings.simplefilter(action='ignore', category=FutureWarning)
    warnings.simplefilter(action='ignore', category=UserWarning)
    
    import mpld3
    from tensorflow.python.lib.io import file_io
    import json

        
    fs = gcsfs.GCSFileSystem(project='YDataSynthetic', token = 'cloud')

    df = pd.read_csv(df_churn_ip)
    df2 = pd.read_csv(df_churn_ip2)

    df1 = df.copy(deep=True)
    df1.to_csv(df_churn_op, index=False)
    
    sns.set(style="white")
    df['TotalCharges'] = df['TotalCharges'].replace(" ", 0).astype('float32')
    
    
    df['total_charges_to_tenure_ratio'] = df['TotalCharges'] / df['tenure']
    df['monthly_charges_diff'] = df['MonthlyCharges'] - df['total_charges_to_tenure_ratio']
    df['churn_rate'] = df['Churn'].replace("No", 0).replace("Yes", 1)

    
    #Correlation Heatmap
    
    plt.figure(figsize=(12, 12))
    df.drop(['customerID', 'churn_rate', 'total_charges_to_tenure_ratio', 'monthly_charges_diff'],
            axis=1, inplace=True)
    corr = df.apply(lambda x: pd.factorize(x)[0]).corr()
    ax = sns.heatmap(corr, xticklabels=corr.columns, yticklabels=corr.columns, 
                     linewidths=1, cmap="YlGnBu", square=True)

    fig = plt.gcf()
    s = mpld3.fig_to_html(fig)

    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Graphs/correlation_heatmap.html', 'w') as f:
        f.write(s)

        

    metadata = {
        'version' : 1, 
        'outputs' : [{        
          'type': 'web-app',
          'storage': 'gcs',
          'source': "gs://pipelines_artifacts/Artifacts/Graphs/correlation_heatmap.html",
        }
        ]
    }
    
    with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
        json.dump(metadata, f)

    with file_io.FileIO(mlpipeline_ui_metadata, 'w') as f:
        json.dump(metadata, f)



kfp_mixed_analysis = kfp.components.func_to_container_op(func = mixed_analysis, 
                                                          output_component_file = './mixed_analysis.yaml',
                                                          packages_to_install = ['gcsfs', 'scikit-learn==0.22.2',
                                                                                 'numpy==1.17.2',
                                                                                 'pandas==1.0.3',
                                                                                 'seaborn==0.9.0',
                                                                                 'matplotlib==3.1.1',
                                                                                 'mpld3==0.5.1'])<jupyter_output><empty_output><jupyter_text>Statistical Analysis and Artifact Generation for Numerical Data Features<jupyter_code>def numerical_analysis(df_churn_ip :InputPath(), mlpipeline_ui_metadata: OutputPath(), df_churn_op: OutputPath()):
        
    ## Import Required Libraries
    import pandas as pd
    import numpy as np
    import gcsfs
    import seaborn as sns
    import matplotlib.pyplot as plt
    from sklearn.ensemble import RandomForestClassifier
    
    import warnings
    warnings.simplefilter(action='ignore', category=FutureWarning)
    warnings.simplefilter(action='ignore', category=UserWarning)
    
    import mpld3
    from tensorflow.python.lib.io import file_io
    import json

        
    fs = gcsfs.GCSFileSystem(project='YDataSynthetic', token = 'cloud')

    df = pd.read_csv(df_churn_ip)

    df1 = df.copy(deep=True)
    df1.to_csv(df_churn_op, index=False)
    
    sns.set(style="white")
    df['TotalCharges'] = df['TotalCharges'].replace(" ", 0).astype('float32')
    
    
    #kdeplots - tenure, Monthly Charges, Total Charges
    
    def kdeplot(feature):
        fig = plt.figure(figsize=(9, 4))
        plt.title("KDE for {}".format(feature))
        ax0 = sns.kdeplot(df[df['Churn'] == 'No'][feature].dropna(), color= 'navy', label= 'Churn: No')
        ax1 = sns.kdeplot(df[df['Churn'] == 'Yes'][feature].dropna(), color= 'orange', label= 'Churn: Yes')
        
        fig = plt.gcf()
        s = mpld3.fig_to_html(fig)

        with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Graphs/{}.html'.format(feature), 'w') as f:
            f.write(s)

                    
    # Kdeplot - Monthly Charge Differential
    df['total_charges_to_tenure_ratio'] = df['TotalCharges'] / df['tenure']
    df['monthly_charges_diff'] = df['MonthlyCharges'] - df['total_charges_to_tenure_ratio']

    kdeplot('monthly_charges_diff')
    
    
    #Monthly Charges vs Tenure for SeniorCitizen
    
    df['churn_rate'] = df['Churn'].replace("No", 0).replace("Yes", 1)
    g = sns.FacetGrid(df, row='SeniorCitizen', col="gender", hue="Churn", height=3.5)
    g.map(plt.scatter, "tenure", "MonthlyCharges", alpha=0.6)
    g.add_legend()

    fig = plt.gcf()
    s = mpld3.fig_to_html(fig)

    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Graphs/scatterplot2.html', 'w') as f:
        f.write(s)    


    metadata = {
        'version' : 1, 
        'outputs' : [{        
          'type': 'web-app',
          'storage': 'gcs',
          'source': "gs://pipelines_artifacts/Artifacts/Graphs/monthly_charges_diff.html",
        },
            {        
          'type': 'web-app',
          'storage': 'gcs',
          'source': "gs://pipelines_artifacts/Artifacts/Graphs/scatterplot2.html",
        }
        ]
    }
    
    with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
        json.dump(metadata, f)

    with file_io.FileIO(mlpipeline_ui_metadata, 'w') as f:
        json.dump(metadata, f)



kfp_numerical_analysis = kfp.components.func_to_container_op(func = numerical_analysis, 
                                                          output_component_file = './numerical_analysis.yaml',
                                                          packages_to_install = ['gcsfs', 'scikit-learn==0.22.2',
                                                                                 'numpy==1.17.2',
                                                                                 'pandas==1.0.3',
                                                                                 'seaborn==0.9.0',
                                                                                 'matplotlib==3.1.1',
                                                                                 'mpld3==0.5.1'])<jupyter_output><empty_output><jupyter_text>Data Cleaning and Column Elimination<jupyter_code>from typing import NamedTuple
from kfp.components import *

def data_cleaning(df_churn_ip: InputPath(), df_churn_imputed :InputPath(), df_cleaned: OutputPath()):
    
    import pandas as pd
    import numpy as np
    from sklearn.preprocessing import StandardScaler
    
    df = pd.read_csv(df_churn_ip)
    df_churn_imp = pd.read_csv(df_churn_imputed)

    df['TotalCharges'] = df['TotalCharges'].replace(" ", 0).astype('float32')
    df.drop(['customerID'],axis=1, inplace=True)


    categorical_cols = [c for c in df.columns if df[c].dtype == 'object'
                        or c == 'SeniorCitizen']
    df_categorical = df[categorical_cols].copy()
    for col in categorical_cols:
        if df_categorical[col].nunique() == 2:
            df_categorical[col], _ = pd.factorize(df_categorical[col])
        else:
            df_categorical = pd.get_dummies(df_categorical, columns=[col])

    numerical_cols = ['tenure', 'MonthlyCharges', 'TotalCharges']
    df_std = pd.DataFrame(StandardScaler().fit_transform(df[numerical_cols].astype('float64')),
                           columns=numerical_cols)

    df_processed = pd.concat([df_std, df_categorical], axis=1)

    # Remove Gender
    features = ['gender']
    df_processed.drop(features, axis=1, inplace=True)

    # Remove services with 'no internet' label
    features = ['OnlineSecurity_No internet service', 'OnlineBackup_No internet service',
               'DeviceProtection_No internet service', 'TechSupport_No internet service',
               'StreamingTV_No internet service', 'StreamingMovies_No internet service']
    df_processed.drop(features, axis=1, inplace=True)

    # Additional services 'No'
    features = ['OnlineSecurity_No', 'OnlineBackup_No',
               'DeviceProtection_No', 'TechSupport_No',
               'StreamingTV_No', 'StreamingMovies_No']
    df_processed.drop(features, axis=1, inplace=True)

    # Remove PhoneService as MultipleLines has a 'No phone service' label
    features = ['PhoneService']
    df_processed.drop(features, axis=1, inplace=True)   
    
    df_processed.to_csv(df_cleaned, index=False)

kfp_data_cleaning = kfp.components.func_to_container_op(func = data_cleaning, 
                                                          output_component_file = './data_cleaning.yaml',
                                                          packages_to_install = ['scikit-learn==0.22.2','numpy==1.17.2',
                                                                                 'pandas==1.0.3'])<jupyter_output><empty_output><jupyter_text>Machine Learning Algorithm - Logistic Regression<jupyter_code>from typing import NamedTuple
from kfp.components import *

def lgr_model(df_churn_ip: InputPath(), 
              C: float, penalty:str, tol: float, max_iter: int, solver: str,
              conf_matr: OutputPath(),
              mlpipeline_ui_metadata: OutputPath(), mlpipeline_metrics: OutputPath()):
        
    import pandas as pd
    import numpy as np
    from sklearn.model_selection import train_test_split
    from sklearn.linear_model import LogisticRegression
    from sklearn.preprocessing import StandardScaler
    from sklearn.metrics import confusion_matrix, accuracy_score, roc_auc_score, roc_curve, precision_score, recall_score, f1_score
    import json
    import os
    import gcsfs
    from tensorflow.python.lib.io import file_io

    df_churn = pd.read_csv(df_churn_ip)
    df_churn.dropna(inplace=True)

    cval = C
    pen = penalty
    toler = tol
    max_it = max_iter
    solv = solver 
    
    y1 = df_churn['Churn']
    X1 = df_churn.drop(['Churn'],axis=1)

    X_train, X_test, y_train, y_test = train_test_split(X1, y1, random_state=0)

    clf = LogisticRegression(random_state=0, C=cval, penalty=pen, tol=toler, 
                             max_iter=max_it, solver=solv).fit(X_train, y_train)
    
    y_test_pred = clf.predict(X_test)
    y_test_proba = clf.predict_proba(X_test)[:,0]
    
    rf_score = float('%.4f' %accuracy_score(y_test, y_test_pred))   
    rf_precision = float('%.4f' %precision_score(y_test, y_test_pred))
    rf_recall = float('%.4f' %recall_score(y_test, y_test_pred))
    rf_f1 = float('%.4f' %f1_score(y_test, y_test_pred))
    
    print("Accuraccy, Precision, Recall, f1: ")
    print(rf_score, rf_precision, rf_recall, rf_f1)
    
    
    cm = confusion_matrix(y_test, y_test_pred)
    print("Confusion Matrix: {}".format(cm))
    
    fpr, tpr, thresholds = roc_curve(y_test, y_test_proba) 
    auc_score = float('%.4f' %roc_auc_score(y_test, y_test_proba))
    print('Auc score: ')
    print(auc_score)
    
    #Converting the matrix to a Dataframe
    
    flags = {0:'Not Churned',1:'Churned'}
    flag_list = ['Not Churned','Churned']
    data = []
    for target_index, target_row in enumerate(cm):
        for predicted_index, count in enumerate(target_row):
            data.append((flags[target_index], flags[predicted_index], count))

    df_cm = pd.DataFrame(data, columns=['target', 'predicted', 'count'])
    print(df_cm)
    
    with file_io.FileIO(conf_matr, 'w') as f:
        df_cm.to_csv(f, columns=['target', 'predicted', 'count'], header=False, index=False)
        
    fs = gcsfs.GCSFileSystem(project='YDataSynthetic', token = 'cloud')
        
    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/Conf_matLGR.csv', 'w') as f:
        df_cm.to_csv(f, columns=['target', 'predicted', 'count'], header=False, index=False)
    
    
    #roc curve

    df_roc = pd.DataFrame({'fpr': fpr, 'tpr': tpr, 'thresholds': thresholds})
    with file_io.FileIO('gs://pipelines_artifacts/Artifacts/ROC_curveLGR.csv', 'w') as f:
        df_roc.to_csv(f, columns=['fpr', 'tpr', 'thresholds'], header=False, index=False)

    
    #code to generate artifacts
    
    #Artifact generator - metadata
    
    from tensorflow.python.lib.io import file_io
    import json
    
    metadata = {
        'version' : 1, 
        'outputs' : [{
            'type': 'confusion_matrix',
            'format': 'csv',
            'storage': 'gcs',
            'schema': [
                {'name': 'target', 'type': 'CATEGORY'},
                {'name': 'predicted', 'type': 'CATEGORY'},
                {'name': 'count', 'type': 'NUMBER'},
            ],
            'source': 'gs://pipelines_artifacts/Artifacts/Conf_matLGR.csv', #conf_matr
            
       # Convert flags to string because for bealean values we want "True|False" to match csv data.
            'labels': flag_list
        },    
        {
          'type': 'roc',
          'format': 'csv',
          'storage': 'gcs',
          'schema': [
            {'name': 'fpr', 'type': 'NUMBER'},
            {'name': 'tpr', 'type': 'NUMBER'},
            {'name': 'thresholds', 'type': 'NUMBER'},
          ],
          'source': 'gs://pipelines_artifacts/Artifacts/ROC_curveLGR.csv'
        }
        ]
    }
    
    with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
        json.dump(metadata, f)
        
    with file_io.FileIO(mlpipeline_ui_metadata, 'w') as f:
        json.dump(metadata, f)
        

    metrics = {
    'metrics': [{
      'name': 'accuracy-score', # The name of the metric. Visualized as the column name in the runs table.
      'numberValue':  rf_score, # The value of the metric. Must be a numeric value.
      'format': "RAW",   # The optional format of the metric. Supported values are "RAW" (displayed in raw format) and "PERCENTAGE" (displayed in percentage format).
    },
    {
      'name': 'precision-score', # The name of the metric. Visualized as the column name in the runs table.
      'numberValue':  rf_precision, # The value of the metric. Must be a numeric value.
      'format': "RAW",   # The optional format of the metric. Supported values are "RAW" (displayed in raw format) and "PERCENTAGE" (displayed in percentage format).
    },
    {
      'name': 'recall', # The name of the metric. Visualized as the column name in the runs table.
      'numberValue':  rf_recall, # The value of the metric. Must be a numeric value.
      'format': "RAW",   # The optional format of the metric. Supported values are "RAW" (displayed in raw format) and "PERCENTAGE" (displayed in percentage format).
    },
    {
      'name': 'f1-score', # The name of the metric. Visualized as the column name in the runs table.
      'numberValue':  rf_f1, # The value of the metric. Must be a numeric value.
      'format': "RAW",   # The optional format of the metric. Supported values are "RAW" (displayed in raw format) and "PERCENTAGE" (displayed in percentage format).
    },
    {
      'name': 'auc-score', # The name of the metric. Visualized as the column name in the runs table.
      'numberValue':  auc_score, # The value of the metric. Must be a numeric value.
      'format': "RAW",   # The optional format of the metric. Supported values are "RAW" (displayed in raw format) and "PERCENTAGE" (displayed in percentage format).
    }]
    }
    
    with file_io.FileIO('/mlpipeline-metrics.json', 'w') as f:
        json.dump(metrics, f)
        
    with file_io.FileIO(mlpipeline_metrics, 'w') as f:
        json.dump(metrics, f)

kfp_lgr_model = kfp.components.func_to_container_op(func = lgr_model, 
                                                          output_component_file = './lgr-model-func.yaml',
                                                          packages_to_install = ['scikit-learn==0.22.2','numpy==1.17.2',
                                                                                 'pandas==1.0.3',
                                                                                 'gcsfs'])<jupyter_output><empty_output><jupyter_text>Defining the Pipeline Execution Sequence and Input-Output scheme<jupyter_code>import kfp.dsl as dsl
#### Defining the Pipeline Execution Sequence and Input-Output schemeimport kfp.dsl as dsl

@dsl.pipeline(name='Telco Merchant Churn Prediction Pipeline',description='Churn predictions using XGBoost Algorithm')
def TelcoChurnLGR_func(file_path="gs://pipelines_artifacts/Artifacts/Data.csv",
                       C=1.38, penalty='l2', tol=0.0001, max_iter=100, solver='lbfgs'):
    
    #Passing pipeline parameter and a constant value as operation arguments
    read_data_task = kfp_read_data(file_path) 
    
    cat_analysis_task = kfp_categorical_analysis(df_churn_ip = read_data_task.outputs['df_churn_op'])
    mix_analysis_task = kfp_mixed_analysis(df_churn_ip = read_data_task.outputs['df_churn_op'], 
                                           df_churn_ip2 = cat_analysis_task.outputs['df_churn_op'])
    num_analysis_task = kfp_numerical_analysis(df_churn_ip = mix_analysis_task.outputs['df_churn_op'])

    data_cleaning_task = kfp_data_cleaning(df_churn_ip = read_data_task.outputs['df_churn_op'],
                                  df_churn_imputed = num_analysis_task.outputs['df_churn_op'])
    lgr_model_task = kfp_lgr_model(data_cleaning_task.outputs['df_cleaned'],
                                   C, penalty, tol, max_iter, solver)

#For an operation with a single return value, the output reference can be accessed using `task.output` or `task.outputs['output_name']` syntax
#For an operation with a multiple return values, the output references can be accessed using `task.outputs['output_name']` syntax<jupyter_output><empty_output><jupyter_text>Compiling the Pipeline<jupyter_code>pipeline_func = TelcoChurnLGR_func
pipeline_filename = pipeline_func.__name__+'.pipeline.tar.gz'

import kfp.compiler as comp
comp.Compiler().compile(pipeline_func, pipeline_filename)<jupyter_output>/home/ruju/anaconda3/lib/python3.7/site-packages/kfp/components/_data_passing.py:168: UserWarning: Missing type name was inferred as "Float" based on the value "1.38".
  warnings.warn('Missing type name was inferred as "{}" based on the value "{}".'.format(type_name, str(value)))
/home/ruju/anaconda3/lib/python3.7/site-packages/kfp/components/_data_passing.py:168: UserWarning: Missing type name was inferred as "Float" based on the value "0.0001".
  warnings.warn('Missing type name was inferred as "{}" based on the value "{}".'.format(type_name, str(value)))
/home/ruju/anaconda3/lib/python3.7/site-packages/kfp/components/_data_passing.py:168: UserWarning: Missing type name was inferred as "Integer" based on the value "100".
  warnings.warn('Missing type name was inferred as "{}" based on the value "{}".'.format(type_name, str(value)))
{'fraction_non_alphanumeric': 0.1204514496983849, 'fraction_numerical': 0.008990075890251022, 'mean_word_length': 2.3349772874756654, 'pattern_counts': {'":': 1, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 85, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '625040', 'license': 'MIT', 'n_tokens_mistral': 8244, 'n_tokens_neox': 7973, 'n_words': 1632, 'path': 'tutorials/Pipelines/Telco Churn/TelcoChurn_LogisticRegression/TelcoChurn_LogisticRegression.ipynb', 'repo_name': 'ydataai/academy', 'size': '25695'}