Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Image Classification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
El Alimi Sara
Image Classification
Commits
6d83eff1
Commit
6d83eff1
authored
1 year ago
by
selalimi
Browse files
Options
Downloads
Patches
Plain Diff
Update readme
parent
4487092d
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
README.md
+10
-0
10 additions, 0 deletions
README.md
cifar.PNG
+0
-0
0 additions, 0 deletions
cifar.PNG
mlp.py
+4
-4
4 additions, 4 deletions
mlp.py
with
15 additions
and
5 deletions
.gitignore
+
1
−
1
View file @
6d83eff1
...
@@ -3,5 +3,5 @@ image/*
...
@@ -3,5 +3,5 @@ image/*
_pycache_/*
_pycache_/*
plotting.py
plotting.py
image-classification/
image-classification/
cifar.PNG
This diff is collapsed.
Click to expand it.
README.md
+
10
−
0
View file @
6d83eff1
...
@@ -57,7 +57,17 @@ X, y = rc.read_cifar('data')
...
@@ -57,7 +57,17 @@ X, y = rc.read_cifar('data')
# Split the Dataset
# Split the Dataset
X_train, y_train, X_test, y_test
=
rc.split_dataset
(
X, y,
split
=
0.9
)
X_train, y_train, X_test, y_test
=
rc.split_dataset
(
X, y,
split
=
0.9
)
```
```
2.
Function to run knn
```
bash
import knn
knn.plot_KNN
(
X_train, y_train, X_test, y_test
)
```
3.
Running the ANN Code
```
bash
import mlp
mlp.plot_ANN
(
X_train,y_train,X_test,y_test
)
```
## Results :
## Results :
### Generating the Graph
### Generating the Graph
1.
Results using KNN:
1.
Results using KNN:
...
...
This diff is collapsed.
Click to expand it.
cifar.PNG
0 → 100644
+
0
−
0
View file @
6d83eff1
324 KiB
This diff is collapsed.
Click to expand it.
mlp.py
+
4
−
4
View file @
6d83eff1
...
@@ -94,7 +94,7 @@ def learn_once_mse(W1, b1, W2, b2, data, targets, learning_rate):
...
@@ -94,7 +94,7 @@ def learn_once_mse(W1, b1, W2, b2, data, targets, learning_rate):
# Update weights and biases of the output layer
# Update weights and biases of the output layer
W2
=
W2
-
learning_rate
*
np
.
dot
(
hidden_layer_output
.
T
,
output_layer_gradients
)
/
data
.
shape
[
0
]
W2
=
W2
-
learning_rate
*
np
.
dot
(
hidden_layer_output
.
T
,
output_layer_gradients
)
/
data
.
shape
[
0
]
b2
=
b2
-
learning_rate
*
(
1
/
hidden_layer_output
.
shape
[
1
])
*
output_layer_gradients
.
sum
(
axis
=
0
)
b2
=
b2
-
learning_rate
*
(
1
/
hidden_layer_output
.
shape
[
1
])
*
output_layer_gradients
.
sum
(
axis
=
0
,
keepdims
=
True
)
# Calculate the error at the hidden layer
# Calculate the error at the hidden layer
hidden_layer_error
=
np
.
dot
(
output_layer_gradients
,
W2
.
T
)
hidden_layer_error
=
np
.
dot
(
output_layer_gradients
,
W2
.
T
)
...
@@ -291,11 +291,11 @@ def run_mlp_training(X_train, labels_train, data_test, labels_test, num_hidden_u
...
@@ -291,11 +291,11 @@ def run_mlp_training(X_train, labels_train, data_test, labels_test, num_hidden_u
- train_accuracies: List of training accuracies across epochs.
- train_accuracies: List of training accuracies across epochs.
- test_accuracy: The final testing accuracy.
- test_accuracy: The final testing accuracy.
"""
"""
input_dimension
=
X_train
.
shape
[
1
]
#
input_dimension = X_train.shape[1]
output_dimension
=
np
.
unique
(
labels_train
).
shape
[
0
]
# Number of classes
#
output_dimension = np.unique(labels_train).shape[0] # Number of classes
# Initialize weights and biases
# Initialize weights and biases
W1
,
b1
,
W2
,
b2
=
initialization
(
input_dimension
,
num_hidden_units
,
output_dimension
)
W1
,
b1
,
W2
,
b2
=
initialization
(
d_in
,
d_h
,
d_out
)
train_accuracies
=
[]
# List to store training accuracies
train_accuracies
=
[]
# List to store training accuracies
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment