Skip to content

Commit

Permalink
spell check
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin-Allaire committed Oct 24, 2023
1 parent 7abab75 commit ad0b3d2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def clusterSeed(
@param[in] event: input DataFrame that contain all track in one event
@param[in] DBSCAN_eps: minimum radius used by the DBSCAN to cluster track together
@param[in] DBSCAN_min_samples: minimum number of tracks needed for DBSCAN to create a cluster
@return: DataFrame identical to the output with an added collumn with the cluster
@return: DataFrame identical to the output with an added column with the cluster
"""
# Perform the DBSCAN clustering and sort the Db by cluster ID
trackDir = event[["eta", "phi", "vertexZ", "pT"]].to_numpy()
Expand Down Expand Up @@ -152,7 +152,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
plt.clf()


# Create historgram filled with the number of seed per cluster
# Create histogram filled with the number of seed per cluster
for event in plotData:
event["nb_seed"] = 0
event["nb_fake"] = 0
Expand All @@ -169,7 +169,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
plt.ylabel("nb cluster")
plt.savefig("nb_seed.png")
plt.clf()
# Create historgram filled with the number of fake seed per cluster
# Create histogram filled with the number of fake seed per cluster
event.loc[event["good/duplicate/fake"] == "fake", "nb_fake"] = (
event.loc[event["good/duplicate/fake"] == "fake"]
.groupby(["cluster"])["cluster"]
Expand All @@ -180,7 +180,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
plt.ylabel("nb cluster")
plt.savefig("nb_fake.png")
plt.clf()
# Create historgram filled with the number of duplicate seed per cluster
# Create histogram filled with the number of duplicate seed per cluster
event.loc[event["good/duplicate/fake"] == "duplicate", "nb_duplicate"] = (
event.loc[event["good/duplicate/fake"] == "duplicate"]
.groupby(["cluster"])["cluster"]
Expand All @@ -191,7 +191,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
plt.ylabel("nb cluster")
plt.savefig("nb_duplicate.png")
plt.clf()
# Create historgram filled with the number of good seed per cluster
# Create histogram filled with the number of good seed per cluster
event.loc[event["good/duplicate/fake"] == "good", "nb_good"] = (
event.loc[event["good/duplicate/fake"] == "good"]
.groupby(["cluster"])["cluster"]
Expand All @@ -202,22 +202,22 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
plt.ylabel("nb cluster")
plt.savefig("nb_good.png")
plt.clf()
# Create historgram filled with the number of truth particle per cluster
# Create histogram filled with the number of truth particle per cluster
event["nb_truth"] = event.groupby(["cluster"])["particleId"].transform("nunique")
event["nb_truth"].hist(bins=10, range=[0, 10])
plt.xlabel("nb truth")
plt.ylabel("nb cluster")
plt.savefig("nb_truth.png")
plt.clf()
# Create historgram filled with the number of cluser per truth particle
# Create histogram filled with the number of cluster per truth particle
event["nb_cluster"] = event.groupby(event.index)["cluster"].transform("nunique")
event["nb_cluster"].hist(bins=30, weights=1 / event["nb_seed"], range=[0, 30])
plt.xlabel("nb cluster")
plt.ylabel("nb truth")
plt.savefig("nb_cluster.png")
plt.clf()

# Create historgram filled with the number of good cluser with more than one
# Create histogram filled with the number of good cluster with more than one
event["nb_good"].hist(bins=10, weights=(event["nb_seed"] > 1) / event["nb_seed"])
plt.xlabel("nb good cluster with more than 1 seed")
plt.ylabel("nb cluster")
Expand All @@ -234,7 +234,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
x = torch.tensor(x_test, dtype=torch.float32)
output_predict = duplicateClassifier(x).detach().numpy()

# creat an array of random value between 0 and 1 of the same size as the output
# Create an array of random value between 0 and 1 of the same size as the output
# output_predict = np.random.rand(len(x_test))

clusteredEvent["score"] = output_predict
Expand All @@ -244,7 +244,7 @@ def renameCluster(clusterarray: np.ndarray) -> np.ndarray:
)
cleanedEvent = clusteredEvent[idx]

# For each cluster only keep the track with the higest score
# For each cluster only keep the track with the highest score
idx = (
cleanedEvent.groupby(["cluster"])["score"].transform(max)
== cleanedEvent["score"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def prepareDataSet(data: pd.DataFrame) -> pd.DataFrame:
"""Format the dataset that have been written from the Csv file"""
"""
@param[in] data: input DataFrame containing 1 event
@return: Formated DataFrame
@return: Formatted DataFrame
"""
data = data
data = data.sort_values("good/duplicate/fake", ascending=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def scoringBatch(batch: list[pd.DataFrame], Optimiser=0) -> tuple[int, int, floa
max_match = 1
# loop over all the batch
for b_data in batch:
# ID of the current particule
# ID of the current particle
pid = b_data[0][0]
# loss for the current batch
batch_loss = 0
Expand All @@ -184,7 +184,7 @@ def scoringBatch(batch: list[pd.DataFrame], Optimiser=0) -> tuple[int, int, floa
prediction = duplicateClassifier(input)
# loop over all the seed in the batch
for index, pred, truth in zip(b_data[0], prediction, b_data[2]):
# If we are changing particle uptade the loss
# If we are changing particle update the loss
if index != pid:
# Starting a new particles, compute the loss for the previous one
if max_match == 0 or max_match == 2:
Expand Down Expand Up @@ -237,7 +237,7 @@ def scoringBatch(batch: list[pd.DataFrame], Optimiser=0) -> tuple[int, int, floa
# Normalise the loss to the batch size
batch_loss = batch_loss / len(b_data[0])
loss += batch_loss
# Perform the gradient decend if an optimiser was specified
# Perform the gradient descent if an optimiser was specified
if Optimiser:
batch_loss.backward()
Optimiser.step()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Acts {

/// Clusterise seed based on their Z position, their direction and their
/// Clusters seed based on their Z position, their direction and their
/// momentum using DBScan
///
/// @param input : Input parameters for the clustering (phi, eta, z, Pt/10)
Expand All @@ -26,7 +26,7 @@ namespace Acts {
std::vector<std::vector<int>> dbscanSeedClustering(
const std::vector<std::vector<double>>& input, float epsilon = 0.07,
int minPoints = 2) {
// DBSCAN algoritm from MLpack used in the seed clustering
// DBSCAN algorithm from MLpack used in the seed clustering
mlpack::DBSCAN dbscan(epsilon, minPoints);

// Compute the space dimension of the input
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Onnx/include/Acts/Plugins/Onnx/SeedClassifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ class SeedClassifier {
/// @param clusters is a map of clusters, each cluster correspond to a vector of seed ID
/// @param networkInput input of the network
/// @return a vector of seedID corresponding the the good seeds
std::vector<int> solveAmbuguity(std::vector<std::vector<int>>& clusters,
std::vector<int> solveAmbiguity(std::vector<std::vector<int>>& clusters,
Acts::NetworkBatchInput& networkInput) const {
std::vector<std::vector<float>> outputTensor = inferScores(networkInput);
std::vector<int> goodSeeds = seedSelection(clusters, outputTensor);
return goodSeeds;
}

private:
// ONNX environement
// ONNX environment
Ort::Env m_env;
// ONNX model for the duplicate neural network
Acts::OnnxRuntimeBase m_duplicateClassifier;
Expand Down

0 comments on commit ad0b3d2

Please sign in to comment.