This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if [ ! -f kafka_2.12-3.0.0.tgz ]; then | |
| wget https://dlcdn.apache.org/kafka/3.0.0/kafka_2.12-3.0.0.tgz | |
| fi | |
| if [ ! -f kafka_2.12-3.0.0 ]; then | |
| tar -xvf kafka_2.12-3.0.0.tgz | |
| fi | |
| mv kafka_2.12-3.0.0 /usr/local/kafka | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if [ ! -f /home/sem/Documents/Tenacious/kafka-local/apache-zookeeper-3.6.3-bin.tar.gz ]; then | |
| wget https://dlcdn.apache.org/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz | |
| fi | |
| tar -xzf apache-zookeeper-3.6.3-bin.tar.gz | |
| mv -r apache-zookeeper-3.6.3-bin /usr/local/zookeeper | |
| mkdir -p /var/lib/zookeeper | |
| cat > /usr/local/zookeeper/conf/zoo.cfg << EOF | |
| > tickTime=2000 | |
| > dataDir=/var/lib/zookeeper | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | LOAD DATA LOCAL INFILE | |
| '/usr/local/airflow/include/I80_stations.csv' | |
| INTO TABLE I80_stations | |
| FIELDS TERMINATED BY ',' | |
| ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | CREATE TABLE IF NOT EXISTS I80_stations | |
| ( ID int, | |
| Fwy int, | |
| Dir CHAR(20), | |
| District int, | |
| County int, | |
| City FLOAT, | |
| State_PM FLOAT, | |
| Abs_PM FLOAT, | |
| Latitude FLOAT, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from causalnex.structure.notears import from_pandas, from_pandas_lasso | |
| class Constraints: | |
| """ | |
| Aids construct manual interference on structural model | |
| """ | |
| def __init__(self, structural_model:from_pandas_lasso = None): | |
| self.structural_model = structural_model | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import pandas as pd | |
| data = pd.read_csv("../data/data.csv") | |
| df = data[['perimeter_mean', 'concavity_mean', | |
| 'radius_worst', 'perimeter_worst', 'area_worst', | |
| 'diagnosis']] | |
| print("DataFrame loaded") | |
| df, non_numeric_cols = preprocess_data.check_numeric(df) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def construct_model(data:pd.DataFrame)-> LogisticRegression: | |
| """Constructs classification model | |
| Args: | |
| data (pd.DataFrame): DataFrame to be used to train and evaluate classification model | |
| Returns: | |
| LogisticRegression: Logistic Regression model to be used for classification | |
| """ | |
| X = data.drop('diagnosis', axis=1) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def draw_graph(structural_model: from_pandas_lasso, path, prog="dot"): | |
| """Draws Causal graph | |
| Args: | |
| structural_model (from_pandas_lasso): Structural model of causalnex | |
| prog (str, optional): Graphics tool to draw pygraphiz graph. Defaults to "dot". | |
| Returns: | |
| image (png) : Causal graph img | |
| """ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from causalnex.plots import plot_structure, NODE_STYLE, EDGE_STYLE | |
| from causalnex.structure import notears | |
| from causalnex.structure.notears import from_pandas, from_pandas_lasso | |
| def construct_structural_model(df:pd.DataFrame, notears=from_pandas_lasso, tabu_parent_nodes=None)-> notears: | |
| """Constructs structural model to be used to draw causal graph | |
| Args: | |
| df (pd.DataFrame): Preprocessed DataFrame that will construct structural model | |
| notears ([type], optional): [description]. Defaults to from_pandas_lasso. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from sklearn.preprocessing import LabelEncoder | |
| def check_numeric(df: pd.DataFrame) -> list: | |
| """checks non-numeric columns | |
| Args: | |
| df (pd.DataFrame): Dataframe to be checked for non-numeric value | |
| Returns: | |
| struct_data (pd.DataFrame): Copied DataFrame | 
NewerOlder