class_docstr: Test behaviour of the from_pandas method
docstr: Structure learnt from regularisation should have very high f1 score relative to the ground truth
docstr_tok: ["Structure","learnt","from","regularisation","should","have","very","high","f1","score","relative","to","the","ground","truth"]
code: def test_f1score_generated(self, adjacency_mat_num_stability):
      """Structure learnt from regularisation should have very high f1 score relative to the ground truth"""
      df = pd.DataFrame(
          adjacency_mat_num_stability,
          columns=["a", "b", "c", "d", "e"],
          index=["a", "b", "c", "d", "e"],
      )
      train_model = StructureModel(df)
      X = generate_continuous_dataframe(
          train_model, 50, noise_scale=1, seed=1
      )
      g = from_pandas(X, lasso_beta=0.1, w_threshold=0.25)
      right_edges = train_model.edges
  
      n_predictions_made = len(g.edges)
      n_correct_predictions = len(
          set(g.edges).intersection(set(right_edges))
      )
      n_relevant_predictions = len(right_edges)
  
      precision = n_correct_predictions / n_predictions_made
      recall = n_correct_predictions / n_relevant_predictions
      f1_score = 2 * (precision * recall) / (precision + recall)
  
      assert f1_score > 0.85
  
imports: import logging
  import networkx
  import numpy
  import pandas
  import pytest
  import scipy.optimize
  from mock import patch
  from causalnex.structure import StructureModel
  from causalnex.structure.data_generators import generate_binary_data, generate_binary_dataframe, generate_continuous_dataframe, generate_count_dataframe, generate_structure
  from causalnex.structure.pytorch.notears import from_numpy, from_pandas
label_desc: Use image node_id 17 for calling the TestFromPandas obj's underlying member method code with example usage: obj.test_f1score_generated(adjacency_mat_num_stability) without return types