This notebook presents CADexBreastCancer_CherubiumWTTU, a computer-aided detection and diagnosis (CADe/x) system for breast cancer based on image analysis and machine learning using the Wolfram Language.
It explores the use of automated tools to assist in the classification of medical images, focusing on distinguishing between cancerous and non-cancerous cases. The notebook includes data processing, model implementation, and an interactive interface for testing predictions.
​
This work was developed as part of the *Wolfram Texas Tech University Hackathon 2025*, where our team investigated the application of artificial intelligence and computational tools to help on healthcare challenges.
​
Readers are invited to download the notebook directly from this post to explore the full implementation, interact with the interface, and examine the methodology in detail!

Introduction

Cherubium is a team of fifth-year students from Colegio Científico Norte Norte in Costa Rica. As students of a scientific high school, our academic training is mainly focused on mathematics, science, and computational thinking. This project was developed as part of our education as young researchers, combining technical skills with a strong interest in using technology to solve real-world problems. Colegio Científico Norte Norte is part of the National System of Scientific High Schools of Costa Rica, a network of public institutions focused on rigorous education in science, mathematics, and technology.
​
Our campus is located in Upala, in the province of Alajuela, and it is a recently inaugurated institution, created to expand high-level academic opportunities for students in the northern region of the country. Despite its short history, the school already reflects the commitment and motivation of its students, who actively work to make the academic potential of the institution visible and to show that scientific talent can also grow outside traditional urban centers.
​
Upala is a canton that borders Nicaragua and is characterized by a mostly rural population. The main economic activities in the area include agriculture, livestock farming, and local commerce. Although access to advanced technology, especially in the health sector, is still limited, there is a strong desire for progress and improvement in quality of life. In our region, access to advanced medical technology is limited compared to urban areas of the country. Health care services in communities like Upala often face challenges related to limited technological resources, long distances to specialized centers, and the ability to respond quickly to situations that require more modern tools.
​
This reality directly affects the quality and speed of medical care and highlights the need for innovative solutions that can adapt to environments with limited resources. From this context, our project emerges as a concrete response to the real needs of our community and as a proposal that seeks to use technology and computational thinking to generate a positive and realistic impact, considering both the current conditions of our community and the potential for improvement in the local health system.
​
Breast cancer is one of the leading causes of mortality among women worldwide, and Costa Rica is no exception. According to what we studied, the five-year survival rate is encouraging; however, this does not reduce the importance of improving early diagnosis, especially for women who are diagnosed at more advanced stages of the disease. Motivated by this reality and by personal stories close to us, the Cherubium team, made up of Sulam Fernández, Ariana Montoya, and Jimena Rodríguez, decided to take on the challenge of using technology to create a positive social impact.
​
One of our main motivations is Doña Yanina Barrantes, Ariana’s mother, who overcame breast cancer but must undergo mammograms every six months, serving as a constant reminder of the importance of continuous monitoring. Additionally, we were inspired by Naggay Fernández, Sulam’s sister, a radiologist specialized in breast imaging, whose professional experience showed us firsthand the need for tools that can help speed up early screenings and reduce errors, supporting the invaluable work of health professionals.
​
With the fundamental support of Colegio Científico Norte Norte, and thanks to the mentorship of the Wolfram team, who guided us from the very beginning in learning a completely new programming language, we embarked on this mission. The goal of this hackathon was to develop a functional educational prototype of a Computer-Aided Detection and Diagnosis (CADe/x) system for breast cancer. Using exclusively the Wolfram Language, Cherubium created an artificial intelligence classifier capable of analyzing mammography images to distinguish between healthy tissue and tissue with the presence of cancer.

World Impact: How Could This Tool Help a Clinic in Costa Rica?

This publicly accessible, cloud-deployed tool could be of great help to clinics in rural areas of Costa Rica in several concrete ways:
◼
  • It would serve as an accessible, automated second opinion and a support system for healthcare professionals, allowing them to rely on an initial automated analysis to help prioritize suspicious cases that require urgent review.
  • ◼
  • By automating the initial classification of mammograms, radiologists could optimize and reduce review times, focusing on detailed analysis of more complex cases and streamlining the diagnostic workflow.
  • ◼
  • Many clinics in peripheral areas lack advanced medical software. Since this tool is cloud-based, it offers democratized access to technology, as it only requires an Internet connection, bringing artificial intelligence capabilities to locations with limited resources.
  • ◼
  • The prototype itself is a valuable educational tool, useful for training radiology technicians and for raising community awareness about the critical importance of early detection.
  • This project represents, for Cherubium, the convergence of technical learning, innovation, and a deep desire to contribute to society’s well-being, with the tangible potential to become an ally in saving lives through faster and more accessible diagnosis across all regions of the country.

    Code

    As a first step, SetDirectory is used to set the folder where both the Notebook file and the mammography database are located.
    In[]:=
    SetDirectory[NotebookDirectory[]]
    Out[]=
    C:\Users\gmeyv\Desktop\DECIMO\.nb folder
    In[]:=
    Directory[]
    Out[]=
    C:\Users\gmeyv\Desktop\DECIMO\.nb folder
    It builds the full path to the “BCID” folder that contains the images and returns the complete path to the image directory.
    In[]:=
    bcidImagesFolder=Directory[]<>"/BCID"
    Out[]=
    C:\Users\gmeyv\Desktop\DECIMO\.nb folder/BCID
    It searches for all JPG files in the BCID folder and its subfolders.
    In[]:=
    bcidImages=FileNames["*jpg",bcidImagesFolder,Infinity]
    It separates the files into non-cancer and cancer folders.
    In[]:=
    examNoCancer="Mammogram Mastery A Robust Dataset for Breast Cancer Detection and Medical Education/Breast Cancer Dataset/Original Dataset/Non-Cancer";​​examCancer="Mammogram Mastery A Robust Dataset for Breast Cancer Detection and Medical Education/Breast Cancer Dataset/Original Dataset/Cancer";
    In[]:=
    examImagesNoCancer=FileNames["*jpg",examNoCancer,Infinity];​​examImagesCancer=FileNames["*jpg",examCancer,Infinity];
    Now with the Length function we can see if it actually recognize the images in each folder
    In[]:=
    Length[examImagesNoCancer]​​Length[examImagesCancer]
    Out[]=
    620
    Out[]=
    125
    Here, the Manipulate function is used to create a list that interacts through strings containing the paths of the images located in the BCID folder.
    In[]:=
    Manipulate[​​Column[{n,​​bcidImages[[n]],​​Image[Import[bcidImages[[n]]],ImageSize->Small]}],​​{n,1,Length[bcidImages],1},​​SaveDefinitions->True]
    Out[]=
    This interactive slider allows for the visual inspection of the ‘No Cancer’ dataset by displaying each image alongside its file path. It serves as a data validation step to ensure that healthy tissue samples are correctly loaded and formatted for training
    In[]:=
    Manipulate[​​Column[{n,​​examImagesNoCancer[[n]],​​Image[Import[examImagesNoCancer[[n]]],ImageSize->Small]}],​​{n,1,Length[examImagesNoCancer],1},​​SaveDefinitions->True]
    Out[]=
    This tool enables a manual review of the ‘Cancer’ dataset, allowing the user to verify the presence of malignant features in each sample.
    In[]:=
    Manipulate[​​Column[{n,​​examImagesCancer[[n]],​​Image[Import[examImagesCancer[[n]]],ImageSize->Small]}],​​{n,1,Length[examImagesCancer],1},​​SaveDefinitions->True]
    Out[]=
    A specific number of images (100) from the cancer folder are randomly imported using RandomSampler. In addition, Short is used to compress the output.
    In[]:=
    nn=Short[RandomSample[examImagesCancer,100]]​​Information[Import[First[%]]]
    Out[]//Short=
    {Mammogram Mastery A Robust Dataset for Breast Cancer Detection and Medical Education/Breast Cancer Dataset/Original Dataset/Cancer\IMG (84).jpg,98,Mammogram Mastery A Robust Dataset for Breast Cancer Detection and Medical Education/Breast Cancer Dataset/Original Dataset/Cancer\IMG (90).jpg}
    Out[]=
    Image
    Color Space
    RGB
    Image Dimensions
    {1920,1080}
    Image Resolution
    Automatic
    Channels
    3
    Interleaving
    True
    Transparency
    False
    Data Type
    Byte
    A specific number of images (100) from the non-cancer folder are randomly imported using RandomSampler. Likewise, Short is used to compress the output.
    nn=Short[RandomSample[examImagesNoCancer,100]]​​Information[Import[First[%]]]
    Out[]//Short=
    {Mammogram Mastery A Robust Dataset for Breast Cancer Detection and Medical Education/Breast Cancer Dataset/Original Dataset/Non-Cancer\IMG (236).jpg,98,Mammogram Mastery A Robust Da…aset/Non-Cancer\IMG (435).jpg}
    Out[]=
    
    Image
    Color Space
    RGB
    Image Dimensions
    {1920,1080}
    Image Resolution
    Automatic
    Channels
    3
    Interleaving
    True
    Transparency
    False
    Data Type
    Byte
    ,{}
    It loads and pre-processes medical images to train a classifier by converting them to 600 px and grayscale, and then trains a classification model so the program can differentiate between images with and without cancer.
    In[]:=
    trainingCancerData=ColorConvert[ImageResize[Import[#],600],"Grayscale"]&/@RandomSample[examImagesCancer,100];​​trainingNoCancerData=ColorConvert[ImageResize[Import[#],600],"Grayscale"]&/@RandomSample[examImagesNoCancer,100];
    This part is for verification. By measuring the length of each set, it is confirmed that everything is properly set up and that all files from each folder are correctly read, returning the number of images that were imported.
    In[]:=
    Length[trainingCancerData]
    Out[]=
    100
    In[]:=
    Length[trainingNoCancerData]
    Out[]=
    100
    We train a classifier using the Classify function. In this instance, the Wolfram Language automatically selects Logistic Regression based on the dataset size (100 examples). It analyzes image features (pixels, contrast, shapes) and assigns a ‘weight’ or importance to each one. It then uses a mathematical function called the Sigmoid Function to map the results between 0 and 1, Is highly efficient and robust, especially when working with smaller datasets, as it avoids the complexity of deep learning and focuses on finding the most direct mathematical correlation between the input data and the diagnosis.
    cancerClassify=Classify[<|"Cancer"->trainingCancerData,"NoCancer"->trainingNoCancerData|>]
    Out[]=
    ClassifierFunction
    Input type: Image
    Classes: Cancer,NoCancer
    Data not saved. Save now
    
    To compare results, we force the use of a Neural Network. Neural networks are composed of layers of artificial neurons that attempt to detect complex, non-linear patterns (such as specific textures or edges in a mammogram). While this is a more powerful state-of-the-art method in medical imaging, it typically requires a massive volume of data to reach its full potential.
    Upon evaluating the Neural Network, we notice a drop in accuracy (57%) and an increase in training time. This provides evidence that with a limited dataset of 200 images, a simpler statistical model (Logistic Regression) is more robust than a complex one (Neural Network), as the latter requires significantly more visual ‘experience’ to generalize correctly.
    The classification method is exported to the cloud.
    Now, an image is imported for further analysis using the methods that were previously trained to classify cancer.
    Now we can use the two methods (Logistic Regression and NeuralNetwork)with an imported image and see how it classifys it
    These interactive sliders allow for the manual verification of the dataset by browsing through individual images and their file paths
    We now proceed to import several images to test them against the two established recognition methods. This process is used both to train the program and to verify the accuracy of its predictions.
    A set of images is defined.
    It creates the option to detect white spots in the images, making it easier to identify the presence of cancer.
    In this section, this function is evaluated using the imported images.
    It can also be evaluated using any other image from the interface.
    Next, the functions are defined so that the program highlights the white spots in mammogram images. Before finding the centroids, the program “blurs” the image to remove noise and then “binarizes” it (turns it strictly black and white) so the bright spots stand out clearly against the dark background.
    These are the exact geometric centers of the “white spots” found in the mammography. The code calculates their $(x, y)$ coordinates.
    This function takes those centroid coordinates and draws the pink/purple boxes you see in the output. This is a way to “show the AI’s work,” proving it is looking at the correct suspicious areas.
    In this section, a cloud-based web form for breast cancer diagnosis is created. It receives mammogram images as input, uses the pre-trained classifier “cancerClassifier,” and returns an automatic diagnosis (Cancer / NoCancer).
    It defines an AI-based function for mammogram diagnosis and creates a web form. This function loads the “cancerClassifier” model from the cloud, pre-processes the image (resizes it to 600 px and converts it to grayscale), obtains diagnostic probabilities (Cancer / NoCancer), and generates a visual report with the image, a pie chart, and model details.

    The program

    Here is what is first shown when entering the page: the interface.
    After some time, we will be redirected to another page where the analysis result is displayed, along with its accuracy percentage, the pie chart and the model detail.

    Conclusion

    For our team, Cherubium, this hackathon experience represented much more than a technological competition. It was a journey of discovery that merged our human purpose with the transformative potential of artificial intelligence.
    ​
    On a technical level, we learned that complex languages such as Wolfram can be mastered when there is proper guidance and clear motivation. We overcame our initial lack of experience to understand how functions like Classify automatically perform a form of “mini transfer learning,” adapting pre-trained models to a critical medical task. Learning to use CloudDeploy showed us how to bridge the gap between a local script and a web-based tool with real potential for impact. The process of cleaning code, debugging errors, and optimizing the workflow taught us that in programming, perseverance and attention to detail are just as crucial as logic.
    ​
    The relevance of our work goes beyond the functional prototype. We demonstrated that it is possible to create an accessible system that can serve as an automated second opinion for clinics with limited resources. Our project is a testament to how technology, in the hands of our generation of women in science, can become a strategic ally in the fight for earlier and more accessible breast cancer detection in Costa Rica.
    ​
    This hackathon did not only teach us how to program in Wolfram; it taught us that our curiosity, when combined with technology and empathy, has the power to change lives. We leave this experience not only as students with stronger technical skills, but as future professionals aware of our ability to create positive change in the world.

    References

    We used platforms developed by Wolfram Research, including Wolfram Mathematica as our main development environment, taking advantage of its native integration with Wolfram Cloud for deploying our web application. The Wolfram Notebook Assistant served as an invaluable guide for resolving syntax-related questions during programming.
    ​
    The data sources we worked with consisted of two open-access medical databases: the CBIS-DDSM dataset from Kaggle, which contains mammography images, and the Mammogram Mastery dataset from Mendeley Data, which provides a wide collection of cases for model training.
    ​
    The official Wolfram Language documentation, accessible directly from Mathematica, was our primary technical resource. We complemented this with examples from the Wolfram Community and consulted the book “An Elementary Introduction to the Wolfram Language” to better understand the workflow of this language.
    ​
    To assess the social impact of our project, we reviewed recent studies on breast cancer survival in Costa Rica, particularly research indexed in PMC/NCBI, as well as official statistics from the Global Cancer Observatory for Central America.
    ​
    We also received valuable guidance from specialists in the fields of oncology and radiology, who helped us understand real clinical challenges and the most relevant features in mammograms for early diagnosis.

    Datasets

    ◼
  • Breast Cancer Image Dataset (Mammographies) (5.3 GB Zip): https://www.kaggle.com/datasets/awsaf49/cbis-ddsm-breast-cancer-image-dataset
  • ◼
  • Breast Cancer Detection and Medical Education Dataset (933 MB Zip): https://data.mendeley.com/datasets/fvjhtskg93/1
  • CITE THIS NOTEBOOK

    Using Wolfram language for early breast cancer detection​
    by Jimena Rodríguez Vargas​
    Wolfram Community, STAFF PICKS, February 14, 2026
    ​https://community.wolfram.com/groups/-/m/t/3639468