Skip to content

Commit

Permalink
Modified README file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaykold committed Aug 19, 2024
1 parent 3b90a20 commit a195bde
Show file tree
Hide file tree
Showing 5 changed files with 328 additions and 62 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ Or using `requirements.txt`:

```pip install -r requirements.txt```

Run ```pip install -e .``` to install the project in editable mode.

Run Jupyter Notebook

```jupyter notebook```

Open `dry_bean.ipynb` and execute the cells to preprocess the data and train the model
Run ```pip install -e .``` to install the required packages and project in editable mode.

## Components

Expand All @@ -108,7 +102,25 @@ To train the model, run the `model_trainer.py` script:

```python src/components/model_trainer.py```

Or use the Makefile by typing ```make``` in your terminal

This will train the model and save the results to the `artifacts` directory.

If you are using windows you can install ```make``` by running this code in your terminal

```Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.WebClient]::new().DownloadString('https://community.chocolatey.org/install.ps1') | Invoke-Expression```

then install make using choco

```choco install make```

To run app.py to predict your bean, use this code command

#### On windows
``` waitress-serve --listen=0.0.0.0:9696 app:app ```

#### On Linux
```gunicorn --bind=0.0.0.0:9696 app:app```

## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
43 changes: 42 additions & 1 deletion notebook/dry_bean.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The raw dataset for this study was obtained from the UCI Machine Learning Repository via an API call using ```ucimlrepo``` (fetch_ucirepo). \n",
"\n",
"It included grains with 16 features in total, comprising 12 dimensions and 4 distinct shapes. The study employed three well-known \n",
"\n",
"classifiers: Logistic Regression (LR), Random Forest (RF), and \n",
"\n",
"Extreme Gradient Boosting (XGB), all with balanced classes.\n",
"\n",
"This dataset has a shape of 13,611 data entries and 17 columns\n",
"\n",
"1. **Area (A)**: The area of a bean zone and the number of pixels within its boundaries.\n",
"\n",
"2. **Perimeter (P)**: Bean circumference is defined as the length of its border.\n",
"3. **Major axis length (L)**: The distance between the ends of the longest line that can be drawn from a bean.\n",
"4. **Minor axis length (l)**: The longest line that can be drawn from the bean while standing perpendicular to the main axis.\n",
"5. **Aspect ratio (K)**: Defines the relationship between L and l.\n",
"6. **Eccentricity (Ec)**: Eccentricity of the ellipse having the same moments as the region.\n",
"7. **Convex area (C)**: Number of pixels in the smallest convex polygon that can contain the area of a bean seed.\n",
"8. **Equivalent diameter (Ed)**: The diameter of a circle having the same area as a bean seed area.\n",
"9. **Extent (Ex)**: The ratio of the pixels in the bounding box to the bean area.\n",
"10. **Solidity (S)**: Also known as convexity. The ratio of the pixels in the convex shell to those found in beans.\n",
"11. **Roundness (R)**: Calculated with the following formula: \\( \\frac{4\\pi A}{P^2} \\)\n",
"12. **Compactness (CO)**: Measures the roundness of an object: \\( \\frac{Ed}{L} \\)\n",
"13. **ShapeFactor1 (SF1)**\n",
"14. **ShapeFactor2 (SF2)**\n",
"15. **ShapeFactor3 (SF3)**\n",
"16. **ShapeFactor4 (SF4)**\n",
"17. **Class**: Seker, Barbunya, Bombay, Cali, Dermosan, Horoz, and Sira"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -97,7 +138,7 @@
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('data/dry_bean.csv')"
"# df = pd.read_csv('data/dry_bean.csv')"
]
},
{
Expand Down
16 changes: 15 additions & 1 deletion static/css/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ body {
}

.login {
width: 400px;
width: 100%;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 700px;
}

.heading {
Expand Down Expand Up @@ -88,3 +89,16 @@ body {
.dropdown-item:hover {
background-color: #f0f0f0;
}

.two-grid{
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 10px;
}
.two-grid-child{
width: 48%;
display: flex;
flex-direction: column;
gap: 20px;
}
25 changes: 22 additions & 3 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,44 @@ const dropDownChild = document.createElement('div');
console.log("input value",input.value)
areaDropDown.style.display = 'none'; // Hide dropdown after selection
});

dropDown.appendChild(dropDownChild);
});}

const areaValues = [1, 2, 3, 4, 5, 6];
const areaValues = [71236, 39318, 34045];

const areaInput = document.getElementById("area-input");
const areaDropDown = document.getElementById("area-dropdown");

populateDropdown(areaInput, areaDropDown, areaValues)


const perimeterValues = [1, 2, 3, 4, 5, 6, 7];
const perimeterValues = [1055.392, 746.921, 681.927];
const perimeterInput = document.getElementById("perimeter-input");
const perimeterDropDown = document.getElementById("perimeter-dropdown");

populateDropdown(perimeterInput, perimeterDropDown, perimeterValues)

const majoraxislengthValues = [345.968599, 279.815434, 252.167650];
const majoraxislengthInput = document.getElementById("majoraxislength-input");
const majoraxislengthDropDown = document.getElementById("majoraxislength-dropdown");

populateDropdown(majoraxislengthInput, majoraxislengthDropDown, majoraxislengthValues)

const minoraxislengthValues = [264.740746, 179.451019, 172.362100];
const minoraxislengthInput = document.getElementById("minoraxislength-input");
const minoraxislengthDropDown = document.getElementById("minoraxislength-dropdown");

populateDropdown(minoraxislengthInput, minoraxislengthDropDown, minoraxislengthValues)

const aspectratioValues = [1.487857, 2.092897, 1.606084];
const aspectratioInput = document.getElementById("aspectratio-input");
const aspectratioDropDown = document.getElementById("aspectratio-dropdown");

populateDropdown(aspectratioInput, aspectratioDropDown, aspectratioValues)

const eccentricityValues = [0.740453, 0.878465, 0.782514];
const eccentricityInput = document.getElementById("eccentricity-input");
const eccentricityDropDown = document.getElementById("eccentricity-dropdown");

populateDropdown(eccentricityInput, eccentricityDropDown, eccentricityValues)
Loading

0 comments on commit a195bde

Please sign in to comment.