Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ the following form: YYYY.0M.0D.

- Designed a Data Structures to HTML component
- Designed an Artificial Neuron component
- Designed a Library System component
- Designed a Library System component

## 2025.10.17

### Added

- Designed a proof of concept for an Artificial Neuron component
21 changes: 4 additions & 17 deletions doc/02-component-proof-of-concept/02-component-proof-of-concept.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Portfolio Part 2: Component Proof-of-Concept

- **Name**: <!-- TODO: fill with first and last name (e.g., Brutus Buckeye) then delete this comment -->
- **Dot Number**: <!-- TODO: fill with OSU dot number (e.g., buckeye.17) then delete this comment -->
- **Due Date**: <!-- TODO: fill out with due date and time (e.g., 10/17 @ 3:10 PM EST) then delete this comment -->
- **Name**: Grace Metz
- **Dot Number**: Metz.403
- **Due Date**: 10/9/25

## Assignment Overview

<!-- TODO: read the assignment overview then delete this comment -->

Previously, you brainstormed three ideas, and hopefully you got some feedback as
well. However, it's impossible to know how reasonable your design actually is
without trying to implement it. Because you're only just learning our full
Expand All @@ -30,8 +28,6 @@ the more work you can put in now, the better.

## Assignment Checklist

<!-- TODO: browse the checklist then delete this comment -->

To be sure you have completed everything on this assignment, we have littered
this document with TODO comments. You can browse all of them in VSCode by
opening the TODOs window from the sidebar. The icon looks like a tree and will
Expand All @@ -53,8 +49,6 @@ to the tree diagram (you may remove this one as well):

## Assignment Learning Objectives

<!-- TODO: read the assignment learning objectives then delete this comment -->

Without learning objectives, there really is no clear reason why a particular
assessment or activity exists. Therefore, to be completely transparent, here is
what we're hoping you will learn through this particular aspect of the portfolio
Expand All @@ -68,8 +62,6 @@ project. Specifically, students should be able to:

## Assignment Rubric: 10 Points

<!-- TODO: read the assignment rubric then delete this comment -->

Again, to be completely transparent, most of the portfolio project, except the
final submission, is designed as a formative assessment. Formative assessments
are meant to provide ongoing feedback in the learning process. Therefore,
Expand Down Expand Up @@ -114,8 +106,7 @@ Below is further rationale/explanation for the rubric items above:
> to create a new design. In you do end up picking one at random, you should
> disclose that here as well.

<!-- TODO: briefly argue your choice of design or design something
new; then delete this comment -->
I believe that the artificial neuron is the one that is the most interesting to me personally, and I also believe that, minus some need for research on machine learning algorithms, the component would likely be fairly simple to implement. At the most basic level, it essentially functions as a calculator; evaluating values based on a pre-set formula and outputting a result.

> Once you've argued your choice of design, make a branch in your new repo called
> something like `proof-of-concept`. There are many ways to do this, but my
Expand All @@ -126,8 +117,6 @@ new; then delete this comment -->
> we'll want a branch that you can later make a pull request from with all
> your changes.

<!-- TODO: make a new branch from main then delete this comment -->

## Assignment Tasks

As stated previously, your goal with this assignment is to produce a Java
Expand All @@ -153,8 +142,6 @@ completed the assignment.

### Changelog

<!-- TODO: update CHANGELOG then delete this comment -->

At the end of every assignment, you should update the
[CHANGELOG.md](../../CHANGELOG.md) file found in the root of the project folder.
Here's what I would expect to see at the minimum:
Expand Down
133 changes: 133 additions & 0 deletions src/Proof.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import java.util.ArrayList;
import java.util.Scanner;

/**
* Very simple implementation of the methods in the Artificial Neuron component.
*
* @author Grace Metz
*
*/
public final class Proof {

/**
* To prevent instantiation.
*/
private Proof() {
}

/**
* Ensure that inputs are valid and usable by the neuron.
*
* @param inputs
* the list of inputs
* @param input
* the String being entered
*/
public static void setInput(ArrayList<String> inputs, String input) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a proof of concept, I would like to see instance methods. That way, we can see the actual data being stored and used.

if (!input.equals(" ") && !input.isEmpty() && input.length() > 1) {
inputs.add(input);
} else {
System.out.println("Input must be a word.");
}
}

/**
* Set all weights and ensure they are usable by the neuron.
*
* @param weights
* the list of weights
* @param weight
* the weight being entered
*/
public static void setWeight(ArrayList<Double> weights, double weight) {
if (weight >= -1 && weight <= 1) {
weights.add(weight);
} else {
System.out.println("Weight must be between -1 and 1.");
}

}

/**
* Sum the weights.
*
* @param weights
* the list of weights
*
* @return the sum of the weights
*/
public static double sum(ArrayList<Double> weights) {
double sum = 0;

for (int i = 0; i < weights.size(); i++) {
sum = sum + weights.get(i);
}

return sum;
}

/**
* Using the sigmoid activation function: an output >= 0.5 means a yes, or
* the neuron has fired.
*
* @param sum
* the sum of the weights
*
* @return whether the neuron has fired.
*/
public static boolean activate(double sum) {
double s = 1.0 / (1.0 + Math.exp(-sum));
boolean fired = false;

if (s >= 0.5) {
fired = true;
}

return fired;
}

/**
* Main.
*
* @param args
*/
public static void main(String[] args) {
// Decide whether today is a good day to go windsurfing
// (conditions should be sunny and windy)
// Using methods setWeight, setInput, activate, and sum

Scanner in = new Scanner(System.in);

ArrayList<String> words = new ArrayList<>();
ArrayList<Double> importance = new ArrayList<>();

System.out.println(
"Please enter a word that describes today's weather: ");
String word = in.nextLine();
setInput(words, word);
System.out.println(
"Please enter how good that condition is for windsurfing (-1 to 1): ");
setWeight(importance, Double.parseDouble(in.nextLine()));
System.out.println("Enter another word? (y/n): ");
String loop = in.nextLine();

while (loop.equals("Y")) {
System.out.println(
"Please enter a word that describes today's weather: ");
word = in.nextLine();
setInput(words, word);
System.out.println(
"Please enter how good that condition is for windsurfing (-1 to 1): ");
setWeight(importance, Double.parseDouble(in.nextLine()));
System.out.println("Enter another word? (y/n): ");
loop = in.nextLine();
}

double total = sum(importance);

System.out.println("Today is a good day for windsurfing: ");
System.out.println(activate(total));

in.close();
}
}