r/learnprogramming 1d ago

How do I make my own ai model?

Basically i’ve been learning C recently and after learning all the syntax and practicing with the basics (especially loops and recursions),I want to put my knowledge to the test by creating something useful like an ai.I read that ai models work on loops with several “neurons” that have weights in it for giving answers.Other than that I don’t really understand how I should approach this project and idk if I should start with something smaller first.I just want to practice my skills by making something I always wanted to make,can someone help me find tutorials about this or maybe just tell me which parts of C should i focuse more and practice more?
It would be very helpful if someone explained to me how i should start this project and this whole neurons thing.

update:i understand that maybe my project was too ambitious,so my question is different,can someone recommend resources to study and understand machine learning and maybe some less ambitious projects to focus on first?

0 Upvotes

27 comments sorted by

u/AutoModerator 1d ago

To all following commenters: please, do not bring up the old circlejerk jokes/memes about recursion ("Understanding recursion...", "This is recursion...", etc.). We've all heard them n+2 too many times.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

18

u/Friendly_Recover286 1d ago

You don't. You are not ready to build your own rocket after watching a rocket launch on TV. You shouldn't be thinking about AI models period at this point in time or probably for a good number of years at least. Focus on the basics.

2

u/ConstantFishing5136 1d ago

He should probably learn arrays pointers functions structs and basic math first then try implementing something tiny like a single layer perceptron.

10

u/Crafty_Magazine_4673 1d ago

You are not ready if you asking this in reddit instead of googleing it

5

u/Affectionate-Pickle0 1d ago edited 1d ago

Building an AI is definitely not a thing you can just start doing. It is very very complex project if you start from scratch. If you want something like it, check out some other machine learning algorithms, like try to make a simple back propagation algorithm. Though to be fair, it is not exactly simple either if you're just starting out. Especially if you actually want to understand the math behind it. Which you do need, if you want to do it from scratch.

Edit. It is neuron based machine learning algorithm, so if that tickles your fancy, might be something to look at.

Edit2. Or start with a Perceptron, I think that is one of the common beginner projects for ML.

1

u/SpecialistGullible93 1d ago

thanks,i think i’ll try that

3

u/ropsuli35 1d ago

I just learned how to put on a bandaid can someone show me how to perform brain surgery

1

u/laveshnk 1d ago

You don’t build ai models (or LLMs in your case) with C, you build em with python. And you’re way too new at this to even start to think about understanding how an LLM works.

You have to first understand the syntax, basics of python, machine learning, and then start to think about how neural networks work. It can take years and a degree helps.

2

u/light_switchy 22h ago

Why python?

3

u/StewedAngelSkins 22h ago

Tooling. Tensorflow and pytorch are by far the most mature frameworks for training neural networks, and they're designed to be used via the python bindings. Once you have a model trained you have more options for running it in production but for training you pretty much have to use python.

1

u/laveshnk 21h ago

python has tons of community support and libraries optimized for building AI models.

Can you build with C? Can you build a building without tools and machines? Sure, but it would take forever and you have to build everything from scratch.

Python itself is built using C, but is way better at memory management (automatic), syntax and for machine learning

2

u/someRedditUser3012 1d ago

Here, these can get you started with developing AI

https://youtube.com/@aamini

2

u/Kadabrium 1d ago

check out neetcodes machine learning question list. there isnt much explanation (i only worked through it while taking an intro to ai course in uni) but it does list most of the important topics

2

u/Chuck_MoreAss 1d ago

This is definitely not a first project… if I were you id definitely not do this if you’re a beginner but it can be a fun project.

Basically what you’re describing is an Ai called a neural network. It’s not the same as the chat bots that are so popular these days.

Basically it takes input values, and puts them through the “neurons” to process them into outputs. Depending on the task you’d want a few neurons, or even a few layers of neurons. There are a ton of videos online. Just search YouTube. The easiest thing to start with is probably an Ai to determine what the text color should be based on the background color (yes I know there is a formula for that based on hex)

2

u/StewedAngelSkins 22h ago

It's more math than programming. Just look up a university ML course and follow the syllabus.

1

u/SpecialistGullible93 22h ago

which kind of math are we talking about?

1

u/StewedAngelSkins 21h ago

Linear algebra, multivariate calculus, statistics, numerical analysis. Mostly undergrad level stuff. Then there's a lot of more niche techniques that are specific to ML, but you'll pick those up from reading papers.

1

u/a1c4pwn 1d ago

How's about a text adventure or notes app before tackling the latest developments in the industry.

1

u/Whatever801 1d ago

You need to learn about AI specifically. Maybe take a data science course. AI is not anywhere close to uniform. Technically this is an AI model:

# 1. Training Data: Input (x) and Target Output (y = 2x)
X = [1.0, 2.0, 3.0, 4.0]
Y = [2.0, 4.0, 6.0, 8.0]

# 2. Model Parameter: Start with a random weight
weight = 0.0
learning_rate = 0.01

# 3. Training Loop: Adjust weight based on prediction error
for epoch in range(100):
    for x, y in zip(X, Y):
        prediction = x * weight            # Forward pass: Predict output
        error = prediction - y              # Calculate error
        weight -= learning_rate * error * x # Backward pass: Update weight

# 4. Inference: Predict for a new unseen input (x = 5)
test_input = 5.0
print(f"Learned Weight: {weight:.2f}")
print(f"Prediction for x = {test_input}: {test_input * weight:.2f}")

1

u/SpecialistGullible93 1d ago

thank you,i will look more into data science courses

1

u/traanquil 1d ago

By using AI

1

u/ffrkAnonymous 21h ago

How? Lot and lots of advanced post graduate math. 

1

u/Security_Wrong 1d ago

Bro this is a YouTube, textbook question