LevinJ / Supply-demand-forecasting

supply demmand gap prediction for ride-hailing
MIT License
74 stars 42 forks source link

numpy issue #1

Open ghost opened 5 years ago

ghost commented 5 years ago

while running the script didineural.oy in implement folder, I am getting the error that numpy.dtype function is not callable, So please help me with that and tell me the exact changes to be done to rectify the issue Selection_018

MakWigglz commented 1 week ago

The selected code is a Python implementation of a Didi neural network model using TensorFlow. The model is designed to predict a target variable based on a set of input features.

Here's a breakdown of the selected code:

  1. Import statements: The code imports necessary libraries, including TensorFlow, NumPy, and other required modules.

  2. Class definition: The code defines a class called DididNeuralNetowrk, which inherits from three other classes: TFModel, PrepareData, and EarlyStopMonitor.

  3. Class attributes: The class has several attributes that define the model's hyperparameters, such as the number of training steps, batch size, early stopping rounds, and dropout probability. It also specifies the list of feature indices to be used for training.

  4. Initialization method: The __init__ method initializes the attributes of the class. It sets up the TensorFlow graph, initializes the inherited classes, and sets up logging.

  5. Method for visualizing the training process: The add_visualize_node method adds TensorFlow operations for visualizing the training process using TensorFlow summaries.

  6. Method for loading input data: The get_input method loads the training, validation, and test data into TensorFlow placeholders. It also preprocesses the input data by scaling it using the Min-Max scaler.

  7. Method for making predictions: The add_inference_node method adds TensorFlow operations for making predictions using the trained model. It defines the neural network architecture with multiple hidden layers.

  8. Method for calculating the loss: The add_loss_node method adds TensorFlow operations for calculating the loss using the predicted values and the true values. It provides two options for calculating the loss: Mean Squared Error (MSE) and Mean Absolute Percentage Error (MAPE).

  9. Method for optimizing the model: The add_optimizer_node method adds TensorFlow operations for optimizing the model using the calculated loss. It uses the Adam optimizer.

  10. Method for calculating the accuracy: The add_accuracy_node method adds TensorFlow operations for calculating the accuracy of the model using the predicted values and the true values.

  11. Method for evaluating the model: The add_evalmetrics_node method adds TensorFlow operations for evaluating the model using the calculated accuracy.

  12. Method for creating a feed dictionary: The feed_dict method creates a TensorFlow feed dictionary that maps data onto TensorFlow placeholders. It provides different options for feeding data for training, validation, and testing.

  13. Method for running the TensorFlow graph: The run_graph method runs the TensorFlow graph for training the neural network model. It iterates through the training steps, calculates the loss and accuracy, and performs early stopping if necessary.

Overall, the selected code provides a complete implementation of a Didi neural network model using TensorFlow, with appropriate comments and documentation for better understanding.