Lo que dices es tu pureza- LA VERDAD SIEMPRE SERA LO MEJOR AUNQUE PIERDAS-- hora es mi turno quiero que se haga una investigacion sobre esta mujer por ser Complice Omitir y Distorcionar informacion que repercuten el vienestar de dos inocentes..
1 Porque no notificastes que habraham y elizabeth habian sido maltratados fisicamente por su madre y yo me entere cuando habraham tenia entre 4 y 6 anos porque no notificastes que yo hable con esa perra para decirle que si volvia a golpear a nos ninos yo le hecharia la policia
2 Casi lloramos yo y mi Psicologa cuando le informe tu reporte que tu dijistes que yo habia llegado todo estresado y distorcionastes el proposito de mi visita Fue saber como evitar confundir or lastimar la mente de los ninos..
3 Porque no comentaste en tu reporte que yo habia ofrecido muchas cosas para Elizabeht y habraham - Tu te enfocastes solo en decir que estoy mal que creo en alianigenas que me resiguen aviones los mismos pagrones que ese abogado y esa mujer han echo. no mencionastes nada de lo que yo ofreci
4 porque no mencionastes que el Psiquiatra queria habalar con ustedes porque tiene una gran potencial de trastornos mentales, porque no mencionastes que esa mujer ha tratado de de enviarme a la carcel sin razon alguno. 1 Por Loco 2 por Maltrato y Violencia Domestica 3 Por tener camaras en mis carros 4 Por secuestro de los ninos, 5 Por Maltratar a los ninos..
5 Porque no mencionastes que esos ninos ese abogado y esa senora le ha labado el cerebro a los ninos, te repeti mill veces que esos ninos habian compartido toda una vida conmingo, se lo pregunte a mis abraham y elizabeth si yo les habia golpeado o gritado tu sabes la respesta y tu te pusistes a decir que yo solo hablo asi para sentirme yo bien.. dejame decirte que apesar que soy hispano eduque a dos ninos con manual de instrucciones
Created at: 2024-10-23 07:53:29
Edit NoteOfreci mas de 3500 al mes cuando Trabajaba en Hanagas tenia mis gastos calcualdos porque me subirian de salario --- Aqui estan las Pruevas Este senor aldo y senora Sonia es un -- child abuser, child maltreatment, heartless, cruel, or inhumane, a psychopathy y andrea tylor y la jueza que tomo una decicion erronea son sus complices, estas personas de dedicaron a burlarce de mi a reirce de mi,
Created at: 2024-10-24 10:33:41
Edit NoteMy Psychologist (John Volpe) and Child Welfare Services Program (Rockville MD - Susam) would like you to ask andrea tylor some questions (taylor is the social service responsible for the investigation of this case)
1 because she did not mention that sonia sandoval hit the children when I was working, - Why didn't you report that Abraham and Elizabeth had been physically abused by their mother in your report?
2 My psychologist and I almost cried when I informed taylor's report. Tayler said in her report that I have a lot of stress and and she distorted the purpose of my visit. My psychologist said that this was false, that she was not notified of any of this... The purpose of my visit was not to hurt the minds of the children and how to handle this situation.
3 Why tyalor didn't mention in your report that I had offered many things to Elizabeth and Abraham? tailor focused only on saying that I am wrong for believing in aliens,. taylor didn't mention anything about what I offered.
4Why taylor didn't mention that the Psychiatrist wanted to talk whit Jugde because Sonia is posible a high potential for mental disorders, why didn't taylor mention that this woman has tried to send me to jail for no reason at all. 1 For being crazy, 2 for Abuse and Domestic Violence, 3 for having cameras in my cars, 4 for kidnapping children, 5 for abusing children...
5 Why taylor didn't mention that those children, that lawyer aldo and sonia have brainwashed the children, I told you a thousand times that those children had shared an entire life with me, I asked my Abraham and Elizabeth if I had hit them or yelled at them, you know the answer and you started saying that I only talk like that to feel good... let me tell you that even though I am Hispanic and I raised two children with an instruction manual
Created at: 2024-10-24 13:13:55
Edit NoteIf Child Welfare Services Program (Rockville MD - Susam) is presented, I want you to ask them a question: did they question
1 did they question all the children involved?
2 did they question all the parents involved?
Created at: 2024-10-24 13:38:48
Edit Note"My psychologist and I want to understand why Aldo Terraza repeatedly laughed when I offered over $2,500 per month in support, even in front of Judge Golman. Taylor also stated that the offer was invalid for support. At that time, I was working for Hanagas. Aldo Terraza and Sania focused on contacting my friends, schools, doctors, and clients to spread the idea that I was mentally unstable. Their actions ultimately led to my job as a contractor going bankrupt, and now I am back to working as an employee with fewer rights, making it very difficult to reach $1,800 per month.
I want to emphasize that my psychologist wants to know why I am being perceived as a bad person when I offered more than I can afford for my children. I would like you to ask this question on my behalf.
I submitted this documentation in Rockville, MD, at the Circuit Court, and a copy is on file under my records as of April 17, 2022, at 12:24 p.m. I also provided a copy to Aldo Terraza on the court date with Judge Golman."
Created at: 2024-10-25 10:53:27
Edit NoteDear Virginia,
My psychologist, John Volpe, and Child Welfare Services Program (Rockville, MD - Susam) would like you to ask Andrea Taylor, the social service representative responsible for the investigation of this case, the following questions:
Physical Abuse Reporting: Why did Andrea Taylor not mention in her report that Sonia Sandoval physically hit the children while I was working? Specifically, why was the physical abuse of Abraham and Elizabeth by their mother not reported?
Misrepresentation of Purpose: My psychologist and I were nearly brought to tears upon reviewing Taylor's report. She stated that I experience a lot of stress and misrepresented the purpose of my visit. My psychologist clarified that this assertion is false and that she was not informed of any such stress. The intent of my visit was not to harm the children's minds but to seek guidance on how to manage our situation.
Omissions in Report: Why did Taylor fail to mention in her report the numerous things I offered to Elizabeth and Abraham? Instead, she focused solely on criticizing my beliefs in aliens without acknowledging any of the positive contributions I made.
Concerns About Sonia: Why did Taylor not report that the psychiatrist wanted to discuss Sonia with the judge due to concerns about her potential mental disorders? Additionally, why did she omit the fact that Sonia has attempted to falsely accuse me of serious offenses, including:
Being mentally unstable
Abuse and domestic violence
Installing cameras in my cars
Kidnapping the children
Abusing the children
Kidnapping Allegations:
Why did Taylor not acknowledge that Aldo and Sonia have influenced the children against me? I have repeatedly expressed that Abraham and Elizabeth have shared a significant part of their lives with me. I asked them if I had ever hit or yelled at them, and I received a clear answer. Yet, Taylor suggested that I only express this to make myself feel better. As a Hispanic parent, I want to emphasize that I raised my children with care and guidance.
We appreciate your attention to these important questions, which are crucial for understanding the dynamics of this case. Thank you for your assistance.
Extra Note:
"My psychologist and I want to understand why Aldo Terraza repeatedly laughed when I offered over $2,500 per month in support, even in front of Judge Golman. Taylor also stated that the offer was invalid for support. At that time, I was working for Hanagas. Aldo Terraza and Sania focused on contacting my friends, schools, doctors, and clients to spread the idea that I was mentally unstable. Their actions ultimately led to my job as a contractor going bankrupt, and now I am back to working as an employee with fewer rights, making it very difficult to reach $1,800 per month.
I want to emphasize that my psychologist wants to know why I am being perceived as a bad person when I offered more than I can afford for my children. I would like you to ask this question on my behalf.
I submitted this documentation in Rockville, MD, at the Circuit Court, and a copy is on file under my records as of April 17, 2022, at 12:24 p.m. I also provided a copy to Aldo Terraza on the court date with Judge Golman."
Sincerely,
Esquin Fuentes
2407230670
Doctor, could you please call my lawyer and explain this to her? He doesn't seem to understand. her Phone is 📞 301-916-1700
Created at: 2024-10-25 11:14:27
Edit NoteMe gustaria que me diera la oportunidad de poder grabar este relato senor j i al finalizar mi relato usted decide si puedo quedarme con el video o le entrego mi telefono y yo regreso por el cuando lo borren tode.. S J usted le dejaria que se escuchara alguna cancion e o b l en la radio o hicieran peliculas en su homenaje en tv. pues bien hice una ca para el g d unios que decia porque permitia que a esas pers les permitieran bien mi tema tiene que er con esto llege a este pais hace 24 anos +/- desque que vine yo he pagado mis taxes y jamas e pedido un benefincio ni en la pandemi me mantuve trabajando.
Created at: 2024-11-02 00:30:26
Edit Notecerebro concient ---- cerebro inconcient
Cerebro lógico ---- Cerebro ilógico
Razonamiento y análisis --- Reacciones impulsivas
Toma de decisiones: evaluar las consecuencias de tus decisiones de manera más clara --------- Sentimientos no racionalizados
No se nace con un cerebro lógico completamente desarrollado -----------nacemos con un cerebro que responde más a lo ilógico o emocional
Somos creaturas pensantes y emocionales que nacemos con un cerebro ilogico o emocional porque Nos dan sentido de identidad, propósito, y nos ayudan a conectarnos con otros de manera significativa son esenciales para la supervivencia y el aprendizaje temprano
Somos criaturas pensantes y emocionales que podemos desarrollar inteligencia. Al nacer, tenemos un cerebro predominantemente ilógico e irracional, con una pequeña capacidad lógica en desarrollo. En resumen, nacemos con una base de respuestas emocionales e instintivas, y, a medida que maduramos, desarrollamos la capacidad lógica y racional.
nuestra mente está en constante actividad, generando pensamientos sobre diversas experiencias, recuerdos y expectativas de forma infinita Al centrar nuestra atención en un pensamiento particular, eso puede evocar una respuesta emocional (felicidad -estresante - odio) si esa emoción persiste en el tiempo, se transforma en un sentimiento más duradero. Por eso, aprender a observar nuestros pensamientos a la luz de la lógica nos ayuda a entender y gestionar nuestras emociones de manera más efectiva. Esto nos permite no solo reaccionar de forma más consciente, sino también cultivar un bienestar emocional más equilibrado.
Created at: 2024-11-02 00:54:44
Edit NoteHello Virginia,
I have already spoken with Ana. Ana is not a psychologist; she needs to renew her license every two years and must be supervised by an LP (Licensed Professional) with a degree in Psychology. Ana works for Vesta, Inc., and her programs are focused on:
Residential Rehabilitation Programs (RRP)
Substance Abuse Counseling
Supported Housing
I am specifically interested in an LP, LMFT, or a Psychologist/Family Therapist. I believe the Judge should decide whether Ana is qualified for this case. Whatever the Judge decides is fine with me.
Ana scheduled an appointment for me on December 2 at 3 PM. However, Ana does not have an online background or information about her professional history.
In my opinion, Ana is not qualified for this situation, and I will leave it to the Judge to determine her suitability.
Thank you,
[Your Name]
Created at: 2024-11-22 15:49:46
Edit Note-------------------------1---------------------------------------
"I have never claimed to have communicated with extraterrestrials. What I have said is that I believe it is impossible for us to be the only intelligent life in this infinite universe—and I am far from alone in this belief. The scientific evidence, alongside government disclosures, continues to add weight to this idea.
For example, governments around the world have been releasing information about unidentified aerial phenomena (UAPs) for decades:
1991: Russia made UFO documents public after the USSR collapsed.
1997: Chile created CEFAA to study anomalous aerial phenomena.
2004: Brazil and Mexico disclosed military reports of UFO encounters.
2007: France's GEIPAN initiative published years of UFO studies.
2008: The United Kingdom declassified decades of Ministry of Defence UFO reports.
2013: Peru reopened investigations into UFO sightings through its OIFAA program.
2017: The United States released Pentagon-confirmed UFO footage, further explored in news like CBS News.
2024: U.S. congressional hearings revisited the UFO topic, as covered by CNN.
My hypothesis is grounded in science and supported by evidence from studies and research. I do not believe in any deity or unproven tales, but rather in the principles of evolution and the vast, untapped potential of the cosmos."
---------------------------2-----------------------------------------
Fourteen years ago, during the Obama administration, I wrote a letter to the U.S. government questioning a troubling contradiction: If the United States is considered a global authority, how could it permit drug traffickers to promote their lifestyles through movies, music, and merchandise sold freely on platforms like Amazon, eBay, and even in major retailers like Walmart? I argued that glorifying or praising criminals defies basic common sense. After all, who would think of honoring someone like Bin Laden?
In my letter, I emphasized the dangers of allowing such content to flourish unchecked, as it undermines societal values and sends a harmful message. I provided evidence to support my concerns, pointing out that many artists and media figures contribute to this glorification. For this, I was investigated for two years—
Kate del Castillo and Joaquín "El Chapo" Guzmán.
https://www.netflix.com/title/80184569
https://www.cnn.com/2016/01/13/americas/mexico-el-chapo-guzman/index.html
https://www.buzzfeednews.com/article/claudiarosenbaum/armie-hammer-secures-life-rights-of-la-barbie
Tucanes de Tijuana
https://www.infobae.com/mexico/2023/10/11/como-han-vinculado-a-los-tucanes-de-tijuana-con-el-narcotrafico/
https://www.infobae.com/mexico/2023/11/10/quienes-son-los-artistas-que-cantaban-en-fiestas-del-cartel-de-sinaloa/
etc etc etc
While I understand the importance of free expression, I also believe it must operate within reasonable limits and adhere to societal rules. Praising criminals should never fall under the umbrella of freedom. This is a matter of the past, and I fail to see why it remains relevant today.
--------------------------------3---------------------------------------
1 I believe we are not alone in the universe.
2 I strongly oppose the glorification of criminals or drug traffickers.
2 I am not being persecuted by anyone.
If you need to report suspicious activities in the United States, here are the key numbers:
Emergency Situations: Call 911 if there is an immediate threat to life or property.
FBI Tip Line: Report suspicious activities or tips to the FBI at 1-800-CALL-FBI (1-800-225-5324) or submit a tip online at tips.fbi.gov.
Department of Homeland Security (DHS): Contact the DHS to report suspicious activity through their See Something, Say Something campaign by calling 1-866-HLS-TIPS (1-866-457-8477).
Created at: 2024-12-01 10:42:44
Edit NoteHola virginai
Quiero entablar una demanda a abogado Aldo
por la suma de 3,500,000
1 Por Difamacion ( estoy loco)
2 Por evitar ver a mis hijos (todos los Psicologos solo piensan el dano que se les esta haciendo a los ninos)
- 01 2024 someti orden emergencia porque dijo que jamas volveria a ver a mis hijos
-06 and 07 2024 busco argumentos de que mis hijos no querian verme
-10 2024 se nego a llevar a los ninos a Open Maind
-11 2004 Le dijo a senor Juez que si llevaria a los ninos con Open Maind
-11-2024 Aldo se retracto que no queria lo que el senor juez Havia dicho si no lo que el decia con otra Psicologa
-11-2024 Yo denege lo que el queria porque erea una terapista especializada en consumo y abuso de sustancia
-12-2024 Dijo que estaba dacuardo a los terminos y condiciones de todo frent a la senora Jueza
-12 -2024 se retracto y dijo que no estaba de acuerdo dejando el valor de la senora jueza en el suelo
3 Por hacerme gastar constantementent con sus servicios pensando que evitara que tarde o temprano mis hijos diran que el esta involucarado en el brain wash
4 Por fingir acuerdos frente del juez y un dia despues busca argumentos diferentes
5 Por mentirle a varios juezes ( no soy alcoholico, fui un padre responsable, utilizo una cuenta bancaria incorrecta para mis soporte de nino)
6 abraham ya mando un mensaje que algo no esta bien y se esta iendo de la cas y este abogado aldo esta haciendo que habraham viva un martirio, la madre de habraham tiene record de haber golpeado a los ninos
Hello Virginia
I want to file a lawsuit against attorney Aldo for the sum of 3,500,000 dollars
1 For Defamation (I'm crazy)
2 To avoid and look for arguments from a relinquished girl that I won't see my children (all psychologists only think about the damage that is being done to children)
- 01 2024 I filed an emergency order because he said I would never see my children again
-02 2024 He said he agreed
-06 and 07 2024 Aldo looked for arguments that my children did not want to see me
-10 2024 He refused to take the children to Open Maind
-11 2004 He told the Judge that he would take the children to Open Maind
-11-2024 Aldo retracted that he did not want what the judge had said but what he said with another psychologist
-11-2024 I denied what he wanted because she was a therapist specialized in substance abuse and consumption
-12-2024 He said that he agreed to the terms and conditions of everything in front of the lady judge
-12-2024 He retracted and said that he was not in agreement agreement leaving the value of the lady judge on the ground
3 For making me spend constantly with his services thinking that he will avoid that sooner or later my children will say that he is involved in the brainwashing
4 For pretending agreements in front of the judge and a day later he looks for different arguments
5 For lying to several judges (I am not an alcoholic, I was a responsible father, I used an incorrect bank account for my child support)
6 Abraham has already sent a message that something is not right and he is leaving the house and this lawyer Aldo is making Habraham live a martyrdom, Habraham's mother has a record of hitting children
Created at: 2024-12-05 14:00:12
Edit NoteHello Virginia
I want to file a lawsuit in civil court against attorney Aldo for the sum of $3,500,000
1 For Defamation (I'm crazy)
2 Aldo siempre Evita y busca argumentos como niña llorando que no veré a mis hijos (todos los psicologos solo piensan en el daño que se esta haciendo a los niños) el esta haciendo algo personal en contra mia afectando el desarrollo mental de los niños
- 01 2024 I filed an emergency order because he said I would never see my children again
-02 2024 Aldo Dijo que estaba de acuerdo que yo fuera a las terapias
-06 and 07 2024 Aldo looked for arguments that my children did not want to see me
-10 2024 Aldo Negotiated to take the children to Open Mind
-11 2004 Aldo told the Judge that he would take the children to Open Mind
-11-2024 Aldo retracted that he did not want what the judge had said but what he said with another psychologist
-11-2024 I denied what he wanted because she was a therapist specialized in substance abuse and consumption
-12-2024 He said that he agreed to the terms and conditions of everything in front of the lady judge
-12-2024 He retracted and said that he was not in agreement leaving the value of the lady judge on the ground
3 For making me spend money constantly on Virginia's services thinking that this will prevent my children from saying sooner or later that he is involved in brainwashing children
4 For pretending agreements in front of the judge and a day later he looks for different arguments
5 For lying to several judges (I am not an alcoholic, I was a responsible father, Aldo used the wrong bank account for my children's support, he says he agrees all the time in front of the judge and then retracts his statement)
6 Abraham has already sent a message that something is not right and he is leaving the house and this lawyer Aldo is making Habraham live a martyrdom, Habraham's mother has a record of hitting children
7 He lied to the judge to get his services paid and the judge accepted it. I don't have the $5,000 he wants me to pay him. I'm paying Virginia with bank loans.
If Aldo does not have consequences for his bad actions, he will continue to make fun of the judges and harm others. If you lie about small things, you lie about big things. I cannot continue with this bipolarity of the lawyer Aldo.I can't stand his actions and behavior, his mistakes... I don't have that much money but I have to do it for my children.
I want at least 500,000 which is equivalent to the net expense I will have for your lies
Virginia, how much do they charge me to open a civil case against Aldo with these arguments and more? Or can you recommend someone for this case, Virginia, or will I go alone to open the lawsuit?
Created at: 2024-12-05 14:23:09
Edit NoteVirginia i need a Civil Court Representative,
I wish to file a civil lawsuit against Attorney Aldo for the sum of $3,500,000, citing the following reasons:
-------------------------Defamation:----------------------------------
1 Attorney Aldo has made statements portraying me as "crazy," which has damaged my reputation and caused emotional distress.
Interference with Parental Rights:
1 Aldo’s actions have directly impacted my relationship with my children, affecting their mental health. Key incidents include:
- January 2024: I filed an emergency order after Aldo stated I would never see my children again.
- February 2024: Aldo initially agreed to my participation in therapy but later sought arguments to block visitation.
-June–July 2024: He claimed my children did not want to see me.
-October 2024: He negotiated to involve "Open Mind" services but later retracted his stance before the judge.
-November 2024: Aldo lied to the court, suggesting another psychologist over the judge's recommendation, and later suggested a therapist unsuitable for the case.
-December 2024: He agreed to terms before the judge, only to retract his agreement shortly after, undermining the court’s authority.
Financial Loss and Emotional Distress:
2 Aldo’s actions have caused significant financial hardship, compelling me to take loans to meet legal expenses. His deceptive behavior, including making false agreements before the court and retracting them later, has been costly and emotionally taxing.
False Claims:
Aldo has misrepresented facts in court, such as:
Suggesting I am an alcoholic or an irresponsible father.
Using incorrect bank accounts for child support payments.
---------------Child Welfare Concerns:--------------------------------
My child, Abraham, has expressed distress due to this situation, and there are allegations that his mother has a history of physically disciplining the children. Aldo's actions are exacerbating this situation, creating a hostile environment for my children.
Misuse of Judicial Resources:
Aldo falsely justified his legal fees, resulting in undue financial burdens on me, while he made a mockery of court proceedings with his dishonest conduct.
--------------------------To the Honorable Court,---------------------
I respectfully bring to your attention that Attorney Aldo failed to appear on the scheduled court date, citing illness as the reason for his absence. However, based on his prior conduct, there is reason to believe that this may be a deliberate strategy to delay proceedings and evade accountability for his actions, which have not been appropriately addressed to date.
I kindly request the court to review this matter and consider appropriate measures to ensure the integrity of these proceedings..
I kindly request the court to issue a formal warning to Attorney Aldo regarding his behavior. Should such actions persist, I believe the fair and just course would be to initiate a review of his professional conduct and consider revoking his license if deemed appropriate.
--------------------- Conclusion----------------
Given the financial and emotional toll these events have taken, I am seeking a Minimum award of $500,000 to cover net expenses and damages incurred due to Aldo's misconduct or $3,500,000 total so I can continue paying my Psicologis advisors.
-------------------Request for Guidance: -------------------
Virginia How much would it cost me to file this civil lawsuit?
or can you virginia recommend an attorney with experience in handling these types of cases, or should i proceed to file the application independently?
Thank you for your time and assistance. I am committed to pursuing justice not only for myself but also to protect others from being subjected to similar misconduct.
Created at: 2024-12-05 14:37:50
Edit Noteprivate $weights = [
[w1, w2], // Weights for the first input neuron to the hidden neurons
[w3, w4], // Weights for the second input neuron to the hidden neurons
[w5, w6] // Weights for the hidden neurons to the output neuron
];
private $weights = [
[w1, w2, w3, w4], // Weights for the first input neuron to the hidden neurons
[w5, w6, w7, w8], // Weights for the second input neuron to the hidden neurons
[w9, w10, w11, w12], // Weights for the third input neuron to the hidden neurons
[w13, w14] // Weights for the hidden neurons to the output neurons
];
private $weights = [
[w1, w2, w3, w4], // Weights for the first input neuron to the first hidden layer
[w5, w6, w7, w8], // Weights for the second input neuron to the first hidden layer
[w9, w10, w11, w12], // Weights for the third input neuron to the first hidden layer
[w13, w14, w15, w16], // Weights for the first hidden layer to the second hidden layer
[w17, w18, w19, w20], // Weights for the second hidden layer to the output neurons
[w21, w22, w23, w24], // Weights for the second hidden layer to the output neurons
[w25, w26, w27, w28] // Weights for the second hidden layer to the output neurons
];
w1, w2, w3, w4 are the weights connecting the first input neuron to the 4 hidden neurons.
w5, w6, w7, w8 are the weights connecting the second input neuron to the 4 hidden neurons.
w9, w10, w11, w12 are the weights connecting the third input neuron to the 4 hidden neurons.
w13, w14 are the weights connecting the 4 hidden neurons to the 2 output neurons.
The $weights array in these examples helps define the connections between neurons in different layers. Each connection has a corresponding weight that will be adjusted during the training process. These weights are critical for the network's ability to learn from input data and make accurate predictions.
A = [1, 0, 0, 0, 0]
B = [0, 1, 0, 0, 0]
C = [0, 0, 1, 0, 0]
D = [0, 0, 0, 1, 0]
E = [0, 0, 0, 0, 1]
<?php
class NeuralNetwork {
private $weights; // Weights for each layer
public function __construct($layers) {
// Initialize the weights array
$this->weights = [];
// Initialize weights with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
}
}
private function randomMatrix($rows, $cols) {
// Generate a matrix with random values between -1 and 1
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random value between -1 and 1
}
}
return $matrix;
}
}
// Initialize neural network
$nn = new NeuralNetwork([3, 2, 1]);
// Example usage: Display weights for each layer
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Example to display the current weights on form submission
echo "<pre>";
print_r($nn);
echo "</pre>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neural Network - Weights Display</title>
</head>
<body>
<h1>Display Neural Network Weights</h1>
<form method="POST">
<label for="input1">Input 1:</label>
<input type="number" step="any" id="input1" name="input1" required><br>
<label for="input2">Input 2:</label>
<input type="number" step="any" id="input2" name="input2" required><br>
<label for="input3">Input 3:</label>
<input type="number" step="any" id="input3" name="input3" required><br>
<input type="submit" value="Get Weights">
</form>
</body>
</html>
Created at: 2024-12-30 23:04:28
Edit NoteWhat This Code Does:
Biases Initialization: The constructor (__construct()) generates random bias values for each layer based on the number of neurons in that layer.
Random Bias Values: The randomBiases() function generates random bias values between -1 and 1 for each neuron in the layer.
Output: The getBiases() function returns the biases for all layers.
Layer 1 (3 neurons): You will generate 3 random bias values, one for each neuron in this layer.
Layer 2 (4 neurons): You will generate 4 random bias values, one for each neuron in this layer.
Layer 3 (2 neurons): You will generate 2 random bias values, one for each neuron in this layer.
1. Weights:
Purpose: Weights control the strength and direction of the connection between neurons in different layers of the network.
Explanation: Each connection between neurons has a weight that represents how much influence one neuron has on the other. During the training process, these weights are adjusted to minimize the error in the network's output.
2. Biases:
Purpose: Biases allow the activation of neurons to shift, helping the network to better fit the data and improve its ability to learn.
Explanation: Each neuron has a bias, which is added to the weighted sum of inputs before applying the activation function. It helps the neuron to fire (activate) even when the inputs are zero or when no weighted sum is enough to activate it.
Summary:
Weights are the values that connect neurons between layers and are adjusted during training.
Biases are added to the weighted sum of inputs to each neuron and help adjust the output of the neuron.
<?php
class NeuralNetwork {
private $biases; // Biases for each layer
public function __construct($layers) {
// Initialize the biases array
$this->biases = [];
// Initialize biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->biases[$i] = $this->randomBias($layers[$i]);
}
}
// Function to generate random biases for a layer
private function randomBias($neurons) {
$biases = [];
for ($i = 0; $i < $neurons; $i++) {
$biases[$i] = mt_rand(-1000, 1000) / 1000; // Random value between -1 and 1
}
return $biases;
}
// Function to display only the biases
public function displayBiases() {
echo "<h2>Biases</h2>";
echo "<pre>";
print_r($this->biases);
echo "</pre>";
}
}
// Initialize neural network with layers (e.g., 3 input neurons, 4 hidden neurons, 2 output neurons)
$nn = new NeuralNetwork([3, 4, 2]);
// Check if form is submitted and display biases
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nn->displayBiases();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neural Network - Display Biases</title>
</head>
<body>
<h1>Neural Network - Display Biases</h1>
<!-- Form to submit and display biases -->
<form method="POST">
<label for="layer1">Layer 1 Neurons:</label>
<input type="number" id="layer1" name="layer1" value="3" readonly><br>
<label for="layer2">Layer 2 Neurons:</label>
<input type="number" id="layer2" name="layer2" value="4" readonly><br>
<label for="layer3">Layer 3 Neurons:</label>
<input type="number" id="layer3" name="layer3" value="2" readonly><br>
<input type="submit" value="Get Biases">
</form>
</body>
</html>
Created at: 2024-12-30 23:21:58
Edit Noteclass NeuralNetwork { private $layers; // Array defining the number of neurons in each layer
Example in a Real-World Scenario:
Imagine you're creating a neural network to predict whether someone will buy a product based on 3 factors:
Age
Salary
Years of Experience
In this case, the input layer will have 3 neurons (one for each factor), and you will input data such as:
Age = 25
Salary = 50,000
Years of Experience = 5
OR
Predicting House Price
Predicting Student Graduation
Email Spam Classifier
Email Spam Classifier
Predicting Customer Churn (Telecom)
Predicting Health Risk (Diabetes Prediction)
///////////////////////////////////////////////////1 example////////////////////////////////////////////
<?php
class SimpleNeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
public function __construct($layers) {
// Initialize the layers
$this->layers = $layers;
}
public function feedForward($input) {
$output = $input;
// Simulating feedforward process through layers
for ($i = 1; $i < count($this->layers); $i++) {
// For simplicity, just passing the input to the next layer
// In a real neural network, you'd apply a matrix multiplication with weights and biases here
$output = $this->activate($output); // Apply an activation function (e.g., sigmoid)
}
return $output;
}
private function activate($x) {
// Sigmoid activation function for simplicity
// Check if $x is an array and apply sigmoid element-wise
if (is_array($x)) {
foreach ($x as &$value) {
$value = 1 / (1 + exp(-$value)); // Apply sigmoid element-wise
}
} else {
$x = 1 / (1 + exp(-$x)); // Apply sigmoid to scalar
}
return $x;
}
}
// Example usage: Creating a simple neural network with 3 input neurons and 1 output neuron
$nn = new SimpleNeuralNetwork([3, 2, 1]); // 3 inputs, 2 hidden neurons, 1 output
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Gather input data
$input = [
floatval($_POST['age']),
floatval($_POST['salary']),
floatval($_POST['experience']),
];
// Perform the feedforward operation
$output = $nn->feedForward($input);
// Extract the scalar value from the output (since it's an array with one element)
$predictedOutput = is_array($output) ? $output[0] : $output;
// Show prediction and probability
echo "Prediction: " . ($predictedOutput > 0.5 ? "Will Buy" : "Won't Buy");
echo "<br>Predicted Probability: " . number_format($predictedOutput, 4);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neural Network Prediction</title>
</head>
<body>
<h1>Simple Neural Network Prediction</h1>
<form method="POST">
<label for="age">Age:</label>
<input type="number" step="any" id="age" name="age" required><br>
<label for="salary">Salary:</label>
<input type="number" step="any" id="salary" name="salary" required><br>
<label for="experience">Years of Experience:</label>
<input type="number" step="any" id="experience" name="experience" required><br>
<input type="submit" value="Get Prediction">
</form>
</body>
</html>
//////////////////////////////////////////////////////////
<?php
class NeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
private $weights; // Weights for each layer
private $biases; // Bias values for each layer
public function __construct($layers) {
$this->layers = $layers;
$this->weights = [];
$this->biases = [];
// Initialize weights and biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
$this->biases[$i] = $this->randomMatrix($layers[$i], 1);
}
}
private function randomMatrix($rows, $cols) {
// Generate a matrix with random values between -1 and 1
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random value between -1 and 1
}
}
return $matrix;
}
public function feedForward($input) {
$output = $input;
// Feed the input through the layers
for ($i = 1; $i < count($this->layers); $i++) {
// Matrix multiplication of inputs and weights + bias
$output = $this->sigmoid($this->matrixAdd($this->matrixMultiply($this->weights[$i], $output), $this->biases[$i]));
}
return $output;
}
private function sigmoid($x) {
if (is_array($x)) {
// Apply sigmoid to each element in the array (element-wise)
foreach ($x as &$row) {
foreach ($row as &$value) {
$value = 1 / (1 + exp(-$value));
}
}
} else {
$x = 1 / (1 + exp(-$x));
}
return $x;
}
private function matrixMultiply($a, $b) {
$rowsA = count($a);
$colsA = count($a[0]);
$colsB = count($b[0]);
$result = [];
for ($i = 0; $i < $rowsA; $i++) {
for ($j = 0; $j < $colsB; $j++) {
$sum = 0;
for ($k = 0; $k < $colsA; $k++) {
$sum += $a[$i][$k] * $b[$k][$j];
}
$result[$i][$j] = $sum;
}
}
return $result;
}
private function matrixAdd($a, $b) {
$rows = count($a);
$cols = count($a[0]);
$result = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$result[$i][$j] = $a[$i][$j] + $b[$i][$j];
}
}
return $result;
}
}
// Initialize neural network with 5 input features, 4 hidden neurons, and 1 output
$nn = new NeuralNetwork([5, 4, 1]);
// Ensure that the form is submitted and the POST data exists
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['age'], $_POST['salary'], $_POST['experience'], $_POST['education'], $_POST['marital_status'], $_POST['location'])) {
// Get input values and convert them to float for processing
$input = [
[floatval($_POST['age'])],
[floatval($_POST['salary'])],
[floatval($_POST['experience'])],
[floatval($_POST['education'])], // This is an example; adjust based on your input type
[floatval($_POST['marital_status'])], // Likewise, adjust based on your input type
[floatval($_POST['location'])] // Adjust based on your input type
];
// Perform the feedforward operation to get the predicted output
$output = $nn->feedForward($input);
$prediction = $output[0][0] >= 0.5 ? "Will Buy" : "Won't Buy";
// Display the result
echo "Prediction: $prediction<br>";
echo "Predicted Probability: " . number_format($output[0][0], 4);
} else {
echo "Please fill in all the fields.";
}
} else {
// Show initial form if the page is accessed without submission
echo "Please submit the form to get a prediction.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Predict Product Purchase</title>
</head>
<body>
<h1>Predict if someone will buy a product</h1>
<form method="POST">
<label for="age">Age:</label>
<input type="number" step="any" id="age" name="age" required><br>
<label for="salary">Salary:</label>
<input type="number" step="any" id="salary" name="salary" required><br>
<label for="experience">Years of Experience:</label>
<input type="number" step="any" id="experience" name="experience" required><br>
<label for="education">Education Level:</label>
<select id="education" name="education" required>
<option value="1">High School</option>
<option value="2">Bachelor's</option>
<option value="3">Master's</option>
<option value="4">PhD</option>
</select><br>
<label for="marital_status">Marital Status:</label>
<select id="marital_status" name="marital_status" required>
<option value="0">Single</option>
<option value="1">Married</option>
</select><br>
<label for="location">Location:</label>
<input type="text" id="location" name="location" required><br>
<input type="submit" value="Get Prediction">
</form>
</body>
</html>
Created at: 2024-12-30 23:49:15
Edit NoteLet's go through the code to understand how the neural network is set up, how the weights, biases, and layers work, and how it processes input to make predictions.
1. Class Definition: NeuralNetwork
The NeuralNetwork class represents the neural network and handles the essential operations: initializing layers, weights, and biases, feeding forward data, and performing matrix operations.
php
Copy code
class NeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
private $weights; // Weights for each layer
private $biases; // Biases for each layer
$layers: This defines the structure of the neural network — how many neurons there are in each layer.
$weights: This array holds the weight matrices that define the strength of connections between neurons in consecutive layers.
$biases: This array holds the bias values for each neuron in the network.
2. Constructor: __construct($layers)
The constructor initializes the network by setting up layers, weights, and biases.
php
Copy code
public function __construct($layers) {
$this->layers = $layers; // Set layers
$this->weights = []; // Initialize weights array
$this->biases = []; // Initialize biases array
// Initialize weights and biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
$this->biases[$i] = $this->randomMatrix($layers[$i], 1);
}
}
The constructor accepts an array $layers that defines the number of neurons in each layer (e.g., [12, 10, 9, 2, 3] for 12 neurons in the input layer, 10 in the first hidden layer, etc.).
The weights for each layer are initialized using the randomMatrix method. It generates matrices with random values between -1 and 1. This randomness ensures the network starts with different weights for each training process.
3. Method: randomMatrix($rows, $cols)
This method creates a matrix (2D array) with random values for weights or biases.
php
Copy code
private function randomMatrix($rows, $cols) {
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random values between -1 and 1
}
}
return $matrix;
}
It generates random values for each element in a matrix of size rows x cols.
The random values are between -1 and 1 (scaled from mt_rand(-1000, 1000) to a value between -1 and 1).
4. Method: feedForward($input)
This method performs the feedforward operation to pass the input data through the network and obtain the output.
php
Copy code
public function feedForward($input) {
$output = $input;
// Loop through each layer
for ($i = 1; $i < count($this->layers); $i++) {
// Matrix multiplication of inputs and weights + bias
$output = $this->sigmoid($this->matrixAdd($this->matrixMultiply($this->weights[$i], $output), $this->biases[$i]));
}
return $output;
}
Input: The input data is passed to the first layer.
Loop: The data flows through each layer of the network (starting from the input layer).
For each layer, matrix multiplication of weights and inputs is performed, followed by adding biases.
The result is passed through the activation function (sigmoid in this case) to introduce non-linearity.
5. Method: sigmoid($x)
This method applies the sigmoid activation function.
php
Copy code
private function sigmoid($x) {
if (is_array($x)) {
foreach ($x as &$row) {
foreach ($row as &$value) {
$value = 1 / (1 + exp(-$value)); // Apply sigmoid function element-wise
}
}
} else {
$x = 1 / (1 + exp(-$x)); // Apply sigmoid function to single value
}
return $x;
}
Sigmoid function: The sigmoid function transforms inputs into a range between 0 and 1, making it suitable for binary classification problems (e.g., "Will Buy" or "Won't Buy").
6. Matrix Operations
Two important operations are used to process data through the network:
Matrix Multiplication (matrixMultiply): This function multiplies two matrices.
Matrix Addition (matrixAdd): This function adds two matrices (used for adding weights and biases).
7. Display Weights
The displayWeights method is used to output the weights for each layer.
php
Copy code
public function displayWeights() {
foreach ($this->weights as $key => $layerWeights) {
echo "Weights for layer $key:<br>";
foreach ($layerWeights as $neuronWeights) {
echo "[" . implode(", ", $neuronWeights) . "]<br>";
}
}
}
This is useful for debugging or inspecting the network's learned parameters.
8. Form for Prediction
The form collects user input (e.g., age, salary, experience, education) and submits it as a POST request. The neural network then uses the input to predict whether the person will buy the product.
php
Copy code
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['age'], $_POST['salary'], $_POST['experience'], $_POST['education'], $_POST['marital_status'], $_POST['location'])) {
$input = [
[floatval($_POST['age'])],
[floatval($_POST['salary'])],
[floatval($_POST['experience'])],
[floatval($_POST['education'])],
[floatval($_POST['marital_status'])],
[floatval($_POST['location'])],
// Add additional fields if needed to fill all 12 input neurons
[0.0], [0.0], [0.0], [0.0], [0.0], [0.0]
];
// Perform feedforward operation to get the prediction
$output = $nn->feedForward($input);
$prediction = $output[0][0] >= 0.5 ? "Will Buy" : "Won't Buy";
echo "Prediction: $prediction<br>";
echo "Predicted Probability: " . number_format($output[0][0], 4);
} else {
echo "Please fill in all the fields.";
}
}
Prediction: After the user submits the form, the feedForward method is called to calculate the network's prediction based on the input.
Output: The prediction is displayed along with the predicted probability.
Conclusion
In summary, the code represents a simple feedforward neural network for binary classification. It uses layers, weights, and biases to process input data and make predictions. The weights and biases are initialized randomly and the neural network can be trained (though training is not covered here). The neural network uses the sigmoid activation function and matrix operations to propagate data through the layers.
////////////////////////////////////////////////////
Neural Network Initialization (__construct):
This class creates a 6-layer neural network.
The layers are [6, 35, 35, 35, 35, 1], where 6 is the number of input neurons, 35 is the number of neurons in each hidden layer, and 1 is the output neuron.
Weights and biases for each layer are randomly initialized.
<?php
class NeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
private $weights; // Weights for each layer
private $biases; // Biases for each layer
public function __construct($layers) {
$this->layers = $layers;
$this->weights = [];
$this->biases = [];
// Initialize weights and biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
$this->biases[$i] = $this->randomMatrix($layers[$i], 1);
}
}
// Random matrix initialization function
private function randomMatrix($rows, $cols) {
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random values between -1 and 1
}
}
return $matrix;
}
// Feed forward function to pass data through the network
public function feedForward($input) {
$output = $input;
// Loop through each layer
for ($i = 1; $i < count($this->layers); $i++) {
// Matrix multiplication of inputs and weights + bias
$output = $this->sigmoid($this->matrixAdd($this->matrixMultiply($this->weights[$i], $output), $this->biases[$i]));
}
return $output;
}
// Sigmoid activation function
private function sigmoid($x) {
if (is_array($x)) {
foreach ($x as &$row) {
foreach ($row as &$value) {
$value = 1 / (1 + exp(-$value)); // Apply sigmoid function element-wise
}
}
} else {
$x = 1 / (1 + exp(-$x)); // Apply sigmoid function to single value
}
return $x;
}
// Matrix multiplication function
private function matrixMultiply($a, $b) {
$rowsA = count($a);
$colsA = count($a[0]);
$colsB = count($b[0]);
$result = [];
for ($i = 0; $i < $rowsA; $i++) {
for ($j = 0; $j < $colsB; $j++) {
$sum = 0;
for ($k = 0; $k < $colsA; $k++) {
$sum += $a[$i][$k] * $b[$k][$j];
}
$result[$i][$j] = $sum;
}
}
return $result;
}
// Matrix addition function
private function matrixAdd($a, $b) {
$rows = count($a);
$cols = count($a[0]);
$result = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$result[$i][$j] = $a[$i][$j] + $b[$i][$j];
}
}
return $result;
}
}
// Define the number of neurons in each layer (6 input features, 4 hidden layers with 35 neurons each, 1 output neuron)
$nn = new NeuralNetwork([6, 35, 35, 35, 35, 1]);
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Collect input data from the form
if (isset($_POST['age'], $_POST['salary'], $_POST['experience'], $_POST['education'], $_POST['marital_status'], $_POST['location'])) {
// Convert form inputs to float
$input = [
[floatval($_POST['age'])],
[floatval($_POST['salary'])],
[floatval($_POST['experience'])],
[floatval($_POST['education'])],
[floatval($_POST['marital_status'])],
[floatval($_POST['location'])]
];
// Perform feedforward operation to get the prediction
$output = $nn->feedForward($input);
$prediction = $output[0][0] >= 0.5 ? "Will Buy" : "Won't Buy";
// Display the result
echo "Prediction: $prediction<br>";
echo "Predicted Probability: " . number_format($output[0][0], 4);
} else {
echo "Please fill in all the fields.";
}
} else {
echo "Please submit the form to get a prediction.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Predict Product Purchase</title>
</head>
<body>
<h1>Predict if someone will buy a product</h1>
<form method="POST">
<label for="age">Age:</label>
<input type="number" step="any" id="age" name="age" required><br>
<label for="salary">Salary:</label>
<input type="number" step="any" id="salary" name="salary" required><br>
<label for="experience">Years of Experience:</label>
<input type="number" step="any" id="experience" name="experience" required><br>
<label for="education">Education Level:</label>
<select id="education" name="education" required>
<option value="1">High School</option>
<option value="2">Bachelor's</option>
<option value="3">Master's</option>
<option value="4">PhD</option>
</select><br>
<label for="marital_status">Marital Status:</label>
<select id="marital_status" name="marital_status" required>
<option value="0">Single</option>
<option value="1">Married</option>
</select><br>
<label for="location">Location:</label>
<input type="text" id="location" name="location" required><br>
<input type="submit" value="Get Prediction">
</form>
</body>
</html>
//////////////////////////////
<?php
class NeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
private $weights; // Weights for each layer
private $biases; // Biases for each layer
public function __construct($layers) {
$this->layers = $layers;
$this->weights = [];
$this->biases = [];
// Initialize weights and biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
$this->biases[$i] = $this->randomMatrix($layers[$i], 1);
}
}
// Random matrix initialization function
private function randomMatrix($rows, $cols) {
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random values between -1 and 1
}
}
return $matrix;
}
// Feed forward function to pass data through the network
public function feedForward($input) {
$output = $input;
// Loop through each layer
for ($i = 1; $i < count($this->layers); $i++) {
// Matrix multiplication of inputs and weights + bias
$output = $this->sigmoid($this->matrixAdd($this->matrixMultiply($this->weights[$i], $output), $this->biases[$i]));
}
return $output;
}
// Sigmoid activation function
private function sigmoid($x) {
if (is_array($x)) {
foreach ($x as &$row) {
foreach ($row as &$value) {
$value = 1 / (1 + exp(-$value)); // Apply sigmoid function element-wise
}
}
} else {
$x = 1 / (1 + exp(-$x)); // Apply sigmoid function to single value
}
return $x;
}
// Matrix multiplication function
private function matrixMultiply($a, $b) {
$rowsA = count($a);
$colsA = count($a[0]);
$colsB = count($b[0]);
$result = [];
for ($i = 0; $i < $rowsA; $i++) {
for ($j = 0; $j < $colsB; $j++) {
$sum = 0;
for ($k = 0; $k < $colsA; $k++) {
$sum += $a[$i][$k] * $b[$k][$j];
}
$result[$i][$j] = $sum;
}
}
return $result;
}
// Matrix addition function
private function matrixAdd($a, $b) {
$rows = count($a);
$cols = count($a[0]);
$result = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$result[$i][$j] = $a[$i][$j] + $b[$i][$j];
}
}
return $result;
}
}
// Define the number of neurons in each layer (6 input features, 4 hidden neurons, 1 output neuron)
$nn = new NeuralNetwork([6, 4, 1]);
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Collect input data from the form
if (isset($_POST['age'], $_POST['salary'], $_POST['experience'], $_POST['education'], $_POST['marital_status'], $_POST['location'])) {
// Convert form inputs to float
$input = [
[floatval($_POST['age'])],
[floatval($_POST['salary'])],
[floatval($_POST['experience'])],
[floatval($_POST['education'])],
[floatval($_POST['marital_status'])],
[floatval($_POST['location'])]
];
// Perform feedforward operation to get the prediction
$output = $nn->feedForward($input);
$prediction = $output[0][0] >= 0.5 ? "Will Buy" : "Won't Buy";
// Display the result
echo "Prediction: $prediction<br>";
echo "Predicted Probability: " . number_format($output[0][0], 4);
} else {
echo "Please fill in all the fields.";
}
} else {
echo "Please submit the form to get a prediction.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Predict Product Purchase</title>
</head>
<body>
<h1>Predict if someone will buy a product</h1>
<form method="POST">
<label for="age">Age:</label>
<input type="number" step="any" id="age" name="age" required><br>
<label for="salary">Salary:</label>
<input type="number" step="any" id="salary" name="salary" required><br>
<label for="experience">Years of Experience:</label>
<input type="number" step="any" id="experience" name="experience" required><br>
<label for="education">Education Level:</label>
<select id="education" name="education" required>
<option value="1">High School</option>
<option value="2">Bachelor's</option>
<option value="3">Master's</option>
<option value="4">PhD</option>
</select><br>
<label for="marital_status">Marital Status:</label>
<select id="marital_status" name="marital_status" required>
<option value="0">Single</option>
<option value="1">Married</option>
</select><br>
<label for="location">Location:</label>
<input type="text" id="location" name="location" required><br>
<input type="submit" value="Get Prediction">
</form>
</body>
</html>
///////////////////////////////////////////////////////////////////////////////
<?php
class NeuralNetwork {
private $layers; // Array defining the number of neurons in each layer
private $weights; // Weights for each layer
private $biases; // Bias values for each layer
public function __construct($layers) {
$this->layers = $layers;
$this->weights = [];
$this->biases = [];
// Initialize weights and biases with random values
for ($i = 1; $i < count($layers); $i++) {
$this->weights[$i] = $this->randomMatrix($layers[$i], $layers[$i-1]);
$this->biases[$i] = $this->randomMatrix($layers[$i], 1);
}
}
private function randomMatrix($rows, $cols) {
// Generate a matrix with random values between -1 and 1
$matrix = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$matrix[$i][$j] = mt_rand(-1000, 1000) / 1000; // Random value between -1 and 1
}
}
return $matrix;
}
public function feedForward($input) {
$output = $input;
// Feed the input through the layers
for ($i = 1; $i < count($this->layers); $i++) {
// Matrix multiplication of inputs and weights + bias
$output = $this->sigmoid($this->matrixAdd($this->matrixMultiply($this->weights[$i], $output), $this->biases[$i]));
}
return $output;
}
private function sigmoid($x) {
if (is_array($x)) {
// Apply sigmoid to each element in the array (element-wise)
foreach ($x as &$row) {
foreach ($row as &$value) {
$value = 1 / (1 + exp(-$value));
}
}
} else {
$x = 1 / (1 + exp(-$x));
}
return $x;
}
private function matrixMultiply($a, $b) {
$rowsA = count($a);
$colsA = count($a[0]);
$colsB = count($b[0]);
$result = [];
for ($i = 0; $i < $rowsA; $i++) {
for ($j = 0; $j < $colsB; $j++) {
$sum = 0;
for ($k = 0; $k < $colsA; $k++) {
$sum += $a[$i][$k] * $b[$k][$j];
}
$result[$i][$j] = $sum;
}
}
return $result;
}
private function matrixAdd($a, $b) {
$rows = count($a);
$cols = count($a[0]);
$result = [];
for ($i = 0; $i < $rows; $i++) {
for ($j = 0; $j < $cols; $j++) {
$result[$i][$j] = $a[$i][$j] + $b[$i][$j];
}
}
return $result;
}
}
// Initialize neural network with 5 input features, 4 hidden neurons, and 1 output
$nn = new NeuralNetwork([5, 4, 1]);
// Ensure that the form is submitted and the POST data exists
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['age'], $_POST['salary'], $_POST['experience'], $_POST['education'], $_POST['marital_status'], $_POST['location'])) {
// Get input values and convert them to float for processing
$input = [
[floatval($_POST['age'])],
[floatval($_POST['salary'])],
[floatval($_POST['experience'])],
[floatval($_POST['education'])], // This is an example; adjust based on your input type
[floatval($_POST['marital_status'])], // Likewise, adjust based on your input type
[floatval($_POST['location'])] // Adjust based on your input type
];
// Perform the feedforward operation to get the predicted output
$output = $nn->feedForward($input);
$prediction = $output[0][0] >= 0.5 ? "Will Buy" : "Won't Buy";
// Display the result
echo "Prediction: $prediction<br>";
echo "Predicted Probability: " . number_format($output[0][0], 4);
} else {
echo "Please fill in all the fields.";
}
} else {
// Show initial form if the page is accessed without submission
echo "Please submit the form to get a prediction.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Predict Product Purchase</title>
</head>
<body>
<h1>Predict if someone will buy a product</h1>
<form method="POST">
<label for="age">Age:</label>
<input type="number" step="any" id="age" name="age" required><br>
<label for="salary">Salary:</label>
<input type="number" step="any" id="salary" name="salary" required><br>
<label for="experience">Years of Experience:</label>
<input type="number" step="any" id="experience" name="experience" required><br>
<label for="education">Education Level:</label>
<select id="education" name="education" required>
<option value="1">High School</option>
<option value="2">Bachelor's</option>
<option value="3">Master's</option>
<option value="4">PhD</option>
</select><br>
<label for="marital_status">Marital Status:</label>
<select id="marital_status" name="marital_status" required>
<option value="0">Single</option>
<option value="1">Married</option>
</select><br>
<label for="location">Location:</label>
<input type="text" id="location" name="location" required><br>
<input type="submit" value="Get Prediction">
</form>
</body>
</html>
Age:
Salary:
Years of Experience:
Education Level:
High School
Marital Status:
Single
Location:
Created at: 2024-12-31 00:26:09
Edit Notehttps://dadoftheroads.com/invoices/viewinvoicess.php?invoiceSell=Dad-Of-The-Roads-20250101114812
https://dadoftheroads.com/invoices/viewinvoicess.php?invoiceSell=Dad-Of-The-Roads-20250101120837
Created at: 2025-01-01 11:48:38
Edit Note
kk
https://dadoftheroads.com/invoices/viewinvoicess.php?invoiceSell=Dad-Of-The-Roads-20250107093823
https://dadoftheroads.com/invoices/viewinvoicess.php?invoiceSell=Dad-Of-The-Roads-20250107100255
Created at: 2025-01-07 10:08:22
Edit Note