i m trying create a HierarchicalClustering using linkage but i m getting UndefVarError: HierarchicalClustering not defined… the package is installed
This are my code
Create a matrix from the dataframe
#X = convert(Matrix, wine_df)
Normalize the matrix along its rows
X_norma = transpose(normalize(transpose(wine)))
Define the distance metric to use
dist_metric = Euclidean()
Perform hierarchical clustering
model = linkage(X_norma, dist_metric, “complete”)
Choose the number of clusters
num_clusters = 3
Extract the cluster IDs
clusters = cutree(model, num_clusters)
Hi @Selly_Shivute, welcome to our discourse.
from a cursory look it seems that there is no module called
The documentation for
Clustering.jl only mentions an
hclust function, but I can’t find anything named
So try just
using Clustering in the first line, that might be all you need.
Note: check out the pinned post: (make it easier to help you)
Particularly numbers 2 and 4. It would be much easier to offer help if your code is a self-contained example that looks like this:
# Normalize the matrix along its rows X_norma = transpose(normalize(transpose(wine))) # Define the distance metric to use dist_metric = Euclidean()
self-contained meaning that all everything is previously defined: for example here I’m not sure what kind of variable
wine is supposed to be, and I get
Euclidean is not defined because I don’t know which package it comes from.
thank you Omar, linkage is the one that suppose to do hierarchical clustering and it just giving me an error that linkage is not defined, suppose to be included in clustering package, pls email me at email@example.com so you can try to assist…
Where did you get the information that this should be included in the clustering package? Did you generate this code example using a chatbot or other automated code generation service? If so, I would highly advise against doing that because they often completely make up libraries and lie about what functions are available.
Yes, i have used a chatboat, i m learning Julia and is quite
difficult. I m doing clustering using agglomerative hierarchic to
determine the types of wine.
A ChatBot will prove to be an unreliable navigator to take with you on your Julia journey.
It doesn’t have reliable, up-to-date, maps, it doesn’t have great map-reading skills, and will happily make stuff up if it gets lost, and be convinced that it knows the route when it doesn’t. And, if you can’t tell when it’s lost or lying to you, your journey might take longer than it otherwise would.
That said, they can sometimes carry out simple tasks successfully. But don’t rely on them too much.
HI and welcome to the Julia forum.
A package like
HierarchicalClustering never existed. Your code seems to even try to load a submodule of clustering as
using Clustering.HierarchicalClustering indicates it should exist as a submodule in
Closeting.jl. That never existed.
Maybe the best analogy to why not to use Chatbots for learning coding is that they “halucinate” code. Ok, maybe even aluciantion in a well-educated sense (imagine them peeking into StackExchange and other forums before hallucination).
For very default things this guessing works okayish, but it should always be taken with the carer that you are already knowing what to do you just miss the details.
This is not the case while you are learning that yourself. So I would only use Chatbots if you have learned what you want to do – and even then with much carefulness only.
Concerning your actual problem you want to solve, I am not sure what you were aiming at, so maybe we can help you when you have explained that more (and taken a look at the
Clustering.jl documentation linked above.
import Pkg; Pkg.add(“AdaBoost”) but i m getting an error. The following package names could not be resolved:
* AdaBoost (not found in project, manifest or registry)
i want to implement a classifier using a boosting ensemble technique.
Which package can i use to adaboost? i install RadialBasisFunctionModels but still getting same error
Where do you have the idea from to use some
AdaBoost.jl package? As the message indicates such a package does not exist. And you can not install something that does not exist.
So if you have that from ChatGPT, that is the same as I wrote above, often ChatGPT makes something up.
I have no clue about the application / topic you have in mind so I can not recommend anything, besides not using ChatGPT to generate code.
Maybe look at MLJ, here’s a docs section about ensemble models:
i got this from normal google, i just typed how to build boosting ensemble,
is there a website i can learn Julia? may you please share??
I have the following task to complete and i need to implement a boosting ensemble…i dont get code to understand an ensemble … Julia is so complicated with alot of error… may you assist ?
Consider the dataset available at this link. It contains various attributes of wine, including alcohol, magnesium, hue, etc. Your task is twofold:
- Implement an agglomerative hierarchical clustering algorithm to determine the types of wine;
- Building on the classes identified earlier, implement a classifier using a boosting ensemble technique.
Note that all your models must be implemented in the Julia programming language.
We will follow the criteria below to assess the problem:
- Data preparation and preprocessing. (10%)
- Implementation of the clustering algorithm. (25%)
- Implementation of the classifier. (30%)
- Evaluation Metrics (for the classifier). (15%)
- Overall solution in Julia. (20%)
This looks like a homework problem or course assignment, so please make sure you check any academic integrity rules in completing it.
It’s also not clear to me from the wording of the assignment whether you can use any package for this task, the question might imply implementing the algorithm yourself.
In any case I recommend reading the manual to work out the basics of Julia, and maybe docs for CSV and DataFrames for the data wrangling part. If you encounter errors people here will be generally happy to help if you start a new thread with a reproducible example.