#logarithm class 11 one shot
Explore tagged Tumblr posts
9nid · 9 months ago
Text
youtube
1 note · View note
onlyjihoons · 8 years ago
Text
dream knight; l.j.n
a/n omg guys,, it has been so so long since i have written something, and im so sorry omg,, my school term is getting more hectic than it was before, and also i would like to sincerely apologise to  akutagawahakuryuunosuke im so sorry for taking so long to complete your request bb im almost done and i hope its not too shitty asnsosfo
and also this is a spinoff from @cremethorns Hydrochloric Acid,(i hope you don’t mind!) except it doesnt involve spillage of liquid on jeno and a shirtless jeno bc pg13, also highly based on true events that might have costed my innocence, i couldve caused an acid spill on my classmate lol.
disclaimer: this fic has nothing to do with royalty. or knights.
genre: in the context of The Inheritors,, fluff
synopsis: your crush had to see you at your worst, fainting in home econs, and spraining your ankle at dance, and you thought it was only one sided, and only jeno’s duty as a student councilor to bring you to the infirmary, it all changed when you nearly spilled acid on your crush’s oh-so-perfect face.
Tumblr media
Lee Jeno. Student Councilor. Member of the school’s dance team. Visual. Most sought after chaebol, also heir to one of Korea’s biggest broadcasting companies. He had connections and friends, lots of them, from idols to even influential friends abroad, he has everything.
And you? Heir to your mom’s clothing brand, you had your fair share of inheritance to your name to be honest. But you were low-profile, only making friends with the people you trust. Everyone in your school was either filthy rich or a heir to some company or both. And most of the people had connections, not friends. Even the poorest student in your school lived in a swanky condominuim complex. You were pretty decent looking if you were compared to those of neighbourhood schools, but if you compared yourself to your classmates, you would be one of the less-better-looking ones. Make-up was part of it, plastic surgery is another.
Your crush and yourself were sort of polar opposites. Jeno was friendly and kind-hearted, making girls stop by his classroom just to marvel at his annoyingly good looks, one of the minority that hasn’t gone under the knife and yet this beautiful. He was also a talented human being, he can dance, sing and rap, and on top of that good grades and an mouth-watering amount of inheritance when he graduates from college. You had decent grades, looks and money, but your eyes shot glares at strangers, and the queen of comebacks. Last but not least, the formidable ‘ice queen’. You cursed at your genes for making your resting bitch face really bitchy, you got it from your mom. But under that ‘ice queen’ title was a really really really kind-hearted Y/N, which people failed to believe as they only made connections. You haven’t gone under the knife yet, as your mother chose to believe in au naturael. You didn’t want to either, not like you had to use your face in any kind of situation. You weren’t a model anyway.
Ever since you set foot into the school, you were classmates and tablemates for homeroom with Jeno, not like you were complaining. You easily made friends with Jeno, as he found you really nice to hang around with and one of the few not making connections. Exchanging smiles whenever you passed by each other, a simple, platonic friendship. At least that’s what you thought, at the beginning of high school.
Slowly, your teenage hormones got the better of you and you found yourself constantly looking at Jeno. Your heart started beating at the thought of the boy, and you were practically his partner for every single practical lesson for every subject in school. “Stars align and zodiacs match”, smirked Chenle, your cousin and closest friend in school. 
There was once you and Jeno were paired up for home econs, you thought you would make a good team, as you guys were already comfortable with each other. The school’s kitchen was incredibly humid and hot, while stir-frying the pasta, you passed out due to heat exhaustion. The humidity and the added heat from the gas stove was overbearing for your weak body. Being your partner and a member of the Student Council, (you were too, the both of you are the only student councils in your class) he kindly carried your limp body on his back, and constantly worrying about you. It was super sweet of him to even stay in the infirmary with you until you regained consciousness, recalling his big, brown worried orbs staring into your own. Black locks disarray and sweaty, and then flashing a relieved smile which melted you once again.
4 months later and your crush on him only deepened, you hit yourself mentally for choosing the same co-curricular activity as Jeno. He shot you a big grin when he saw you warming up on the first day of dance, offering to help you stretch, which you politely declined because you didn’t was to scare him off with your flexibility. But alas, the instructor decided to have some weird ‘flexibility evaluation’ which you vowed not to fail, due to your pride and reputation of a ballerina of 11 years. Contrary to your expectations, Jeno only eyed you with adoration? respect? shock? You didn’t want to get your hopes high.
Your instructor was impressed, placing you in the ‘top’ team. Your team bravely chose Gfriend’s Fingertip, also a choreography you had wanted to learn in the longest time. Jeno was in the ‘top’ team for the boys too, they chose BTS’ Not Today. You bit your lip, your teammates voted you to be the centre, SinB. You were flattered, they thought so highly of your dance skills, but you were also pressured to grasp the choreography fast and right, so that you could look the best and also help your teammates too.
While learning the dance break, your legs moved faster that your body could react, the inertia sending you to the laminated wooden floor, producing a small thump on your ankle. You groaned as the excruciating pain shot your ankle like a bullet, srunching your nose. Your teammates rushed to your side, worried as the team’s ace got hurt. Jeno’s team heard the commotion, and rushed to surround you as well. Jeno pushed through them, picking you up bridal style, causing ooh-ahhs, swoons(from the top teams) and glares(mostly from the girls) from the other teams. You instinctively wrapped your arms around his neck, afraid to fall again. Your instructor was puzzled when Jeno approached her with you in his arms, but she then hurriedly waved the both of you off lest your sprain got worse.
“Put me down, Jeno, I can walk,” You tried to wriggle out of his arms, but to no avail as Jeno suddenly ‘dropped’ you, producing a surprised yelp from you and curious gazes from students.
“Your sprain will worsen, princess,” Jeno whispered almost flirtatiously, sending shivers down your spine, “and I’m not Do Bong Soon, you’re not that light either.”
You scoffed, “I’m underweight, Jeno, how could you--” You gasped as Jeno’s faced inched slowly towards yours.
“I’ll kiss this pretty face of yours if you can’t stop talking till we get to the infirmary.” Jeno’s eyes darkened, causing you to gulp.
As much as you wanted his lips on yours, you shook your head profusely, Jeno’s eyes immediately crinkled into crescents, lightheartedly walking towards the infirmary.
In the end, stupid Jeno stayed to help ice your sprain, luckily not serious. The both of you missed dance, but none of you cared, you two were two busy giving each other playful banter to keep track of time.
“Your grades are gonna drop at this rate you are daydreaming in class because of Jeno,” Chenle snapped his fingers, startling you from your daydream.
You rolled your eyes, “Who was the one that got 16/20 for her math test and who was the one that got 12/20 for his math test?”
Chenle raised his hands in defeat, “Serves me right for not studying,”
“Neither did I,” You batted your eyelashes innocently as Chenle glared at you.
The school bell rang, signalling break time.
You and Chenle actually made the effort to pop by the snack shop to get some snacks together, usually it was decided through Rock Paper Scissors to who was the unlucky one to pay for the snacks and make the unwanted trip down. Neither of you actually bothered this time, as Logarithms sucked up all of the brain juice you had replenished during recess.
“Did you hear?” Chenle sipped on his banana milk, “We are getting our permanent lab partners for Chemistry today.”
“Mhmm,” You hummed as you munched on a churro snack, “I’ll probably get Jeno again, what’s new.”
“You see, Y/N, that’s the problem with you!” Chenle snapped suddenly, shocking you.
“P...problem?”
Chenle pinched the bridge of his nose, and hissed, “The reason why you’re always complaining that you can’t get Jeno to be your boyfriend, lies in the actions you do yourself, Y/N. At this rate, your crush on Jeno will be brought to your deathbed, the whole world knowing except him.”
You frowned, “So what is your point here, Chenle, do you want me to splash hydrochloric acid on him so i can see him shirtless? Hmm? Then after that expecting him to sweep me off my feet and plant a kiss on my lips? Like the ones in dramas and fanfictions?”
“Just... confess to him.” Chenle resumed sipping on the artificially flavoured drink, “I mean like, you have been liking him since forever, and besides, he has so many girls going after him. This is your golden chance, couz. And I highly doubt that your feelings for him are one-sided.”
You blinked your eyes, slowly absorbing Chenle’s words. You sighed, Chenle was right, even though you aren’t sure about the one-sided part. 
“Y/N and Jeno. Alright class, please take your seats beside your partner at the designated tables and wait for further instructions.” Your teacher waved the class off, and girls bursting into whiny sobs as they failed to get Jeno as their lab partner, again. It was a simple acid-base titration with hydrochloric acid and sodium hydroxide today, your teacher demonstrated the previous lesson and she wanted to let the class “have a go at it” as she believed in the whole “practical sessions helps with understanding” thing. It did help, in a way, but it was an opportunity for you to stare at Jeno up close, other than homeroom lesson. 
You hid your face in your hands as you saw Jeno approaching your seat with his signature eyesmile, you knew you were a stumbling mess in front of his smile, and your plans of confessing to Jeno would go down the drain.
“Y/N-ie~”Jeno sang as he settled down beside you, “We’re lab partners again.”
Don’t look at him, Don’t ever look at him, you chanted a silent mantra to yourself as you closed your eye in case you spilled your feelings too quickly.
“Y/N?” Jeno called out to you worriedly, “Are you alright? You look very out of it today.”
“It’s just the Logarithms that make me feel very blank in general,” You excused clumsily, “I’m just really tired.”
“Do you want me to be in charge of the burette or...”
“Actually, Jeno, I have something to tell you, and--”
“Alright class, please start now.” Your teacher instructed as students began to measure the amount of acid needed.
“Using a pipette, transfer 20.0cm3 of sodium hydroxide into a cornical flask. Add 2-3 drops of methyl orange into the sodium hydroxide. Describe the colour of the methyl orange.” Jeno read, “Do you want me to do it?”
You nodded slightly, recalling your phobia of handling equipment. It was in middle school, where you kindly helped the teacher to wash the petri dish, but your hands turned butter and the petri dish shattered, startling you. It was a measly petri dish, but it was kind of a big deal to the then you, and from then on you were very cautious around the cleaning of equipment.
“Y/N?” Jeno’s voice snapped you out of your reverie, “Its your turn to add the methyl orange.”
You unscrewed the cap carefully, then cautiously dripping exactly 3 drops of the indicator. So far so good.
“Sodium hydroxide is an alkali,” Jeno noted as he wrote the answer down in the instruction sheet, “Do you want to pour the hydrochloric acid?”
You complied, feeling bad that Jeno had to see this vulnerable side of you today. You poured 30.0cm3 of hydrochloric acid into the beaker, then placing a funnel at the top of the burette. Unfortunately, the burette was taller than your height of 5″2, and you needed to stand on the footrest of your stool to reach to that height.
You carefully poured the acid into the burette, heaving a sigh of relief as you emptied the beaker. Your ‘good’ day shattered when you lost your balance upon descending, and you expected to hit the hard concrete floor of the science lab.
But you didn’t. You were in fact supported by a pair of strong arms, and those arms belonged to none other than your crush, Jeno. His eyes bore a worried look as you hoisted you upright and rubbed your back soothingly.
“You must’ve been really tired Y/N,” Jeno sighed. “I think we should get back to class once we complete this.”
“O-okay.”
“So what is it that you wanted to tell me at the science lab?” Jeno rested his chin on his hands, expectantly waiting for an answer.
“I-I...” You wrung your hands nervously, Jeno nodded for you to continue, “I like you, Jeno-ah.”
Jeno’s eyes widened, but his face was unreadable, “Since when did you begin to like me?”
“I don’t know... since we cooked pasta i guess?” You smiled sheepishly, then slumped in your seat, “Its okay if you can’t reciprocate my feelings, Jeno. I’m fine with it.”
“But I’m not fine with it,” Jeno’s expression darkened, a side you have rarely seen.
“Wh-why?”
“Because I want you to be my girlfriend.”
You blinked your eyes, and also attempting to dig whatever earwax you had out of your ears. Did you hear him right, Lee Jeno wanted to be your boyfriend.
Jeno’s face inched closer to yours, then softly placing his hand on your cheek, “May I...?”
You nodded slightly, and without hesitation, Jeno leaned in and placed his soft lips on yours, an immense feeling of euphoria erupting in your chest. Your hands magically found its way to Jeno’s black locks, pulling him slightly closer to slightly deepen the kiss.
Seconds later, you pulled away, a faint red dusting your cheeks, “I’m sorry I shouldn’t have done that.”
“Its alright, like it was my first kiss so...” Jeno looked away shyly.
“It was mine too.” You confessed, immediately regretting your words as Jeno smirked, “Can I be your last too?”
“Maybe,” You shrugged.
Jeno brought you into his chest, red dusting your cheeks again, “What about now?”
“...Okay.”
Well, no one said that your dream knight has to be in shiny armour, he could be in school uniform too.
43 notes · View notes
a-alex-hammer · 6 years ago
Text
Train and deploy Keras models with TensorFlow and Apache MXNet on Amazon SageMaker
Keras is a popular and well-documented open source library for deep learning, while Amazon SageMaker provides you with easy tools to train and optimize machine learning models. Until now, you had to build a custom container to use both, but Keras is now part of the built-in TensorFlow environments for TensorFlow and Apache MXNet. Not only does this simplify the development process, it also allows you to use standard Amazon SageMaker features like script mode or automatic model tuning.
Keras’s excellent documentation, numerous examples, and active community make it a great choice for beginners and experienced practitioners alike. The library provides a high-level API that makes it easy to build all kind of deep learning architectures, with the option to use different backends for training and prediction: TensorFlow, Apache MXNet, and Theano.
In this post, I show you how to train and deploy Keras 2.x models on Amazon SageMaker, using the built-in TensorFlow environments for TensorFlow and Apache MXNet. In the process, you also learn the following:
To run the same Keras code on Amazon SageMaker that you run on your local machine, use script mode.
To optimize hyperparameters, launch automatic model tuning.
Deploy your models with Amazon Elastic Inference.
The Keras example
This example demonstrates training a simple convolutional neural network on the Fashion MNIST dataset. This dataset replaces the well-known MNIST dataset. It has the same number of classes (10), samples (60,000 for training, 10,000 for validation), and image properties (28×28 pixels, black and white). But it’s also much harder to learn, which makes for a more interesting challenge.
First, set up TensorFlow as your Keras backend (and switch to Apache MXNet later on). For more information, see the mnist_keras_tf_local.py script.
The process is straightforward:
Grab optional parameters from the command line, or use default values if they’re missing.
Download the dataset and save it to the /data directory.
Normalize the pixel values, and one hot encode labels.
Build the convolutional neural network.
Train the model.
Save the model to TensorFlow Serving format for deployment.
Positioning your image channels can be tricky. Black and white images have a single channel (black), while color images have three channels (red, green, and blue). The library expects data to have a well-defined shape when training a model, describing the batch size, the height and width of images, and the number of channels. TensorFlow specifically requires the input shape formatted as (batch size, width, height, channels), with channels last. Meanwhile, MXNet expects (batch size, channels, width, height), with channels first. To avoid training issues created by using the wrong shape, I add a few lines of code to identify the active setting and reshape the dataset to compensate.
Now check that this code works by running it on a local machine, without using Amazon SageMaker.
$ python mnist_keras_tf_vanilla.py Using TensorFlow backend. channels_last x_train shape: (60000, 28, 28, 1) 60000 train samples 10000 test samples <output removed> Validation loss : 0.2472819224089384 Validation accuracy: 0.9126
Training and deploying the Keras model
You must make a few minimal changes, but script mode does most of the work for you. Before invoking your code inside the TensorFlow environment, Amazon SageMaker sets four environment variables
SM_NUM_GPUS—The number of GPUs present on the instance.
SM_MODEL_DIR— The output location for the model.
SM_CHANNEL_TRAINING— The location of the training dataset.
SM_CHANNEL_VALIDATION—The location of the validation dataset.
You can use these values in your training code with just a simple modification:
parser.add_argument('--gpu-count', type=int, default=os.environ['SM_NUM_GPUS']) parser.add_argument('--model-dir', type=str, default=os.environ['SM_MODEL_DIR']) parser.add_argument('--training', type=str, default=os.environ['SM_CHANNEL_TRAINING']) parser.add_argument('--validation', type=str, default=os.environ['SM_CHANNEL_VALIDATION'])
What about hyperparameters? No work needed there. Amazon SageMaker passes them as command line arguments to your code.
For more information, see the updated script, mnist_keras_tf.py.
Training on Amazon SageMaker
After deploying your Keras model, you can begin training on Amazon SageMaker. For more information, see the Fashion MNIST-SageMaker.ipynb notebook.
The process is straightforward:
Download the dataset.
Define the training and validation channels.
Configure the TensorFlow estimator, enabling script mode and passing some hyperparameters.
Train, deploy, and predict.
In the training log, you can see how Amazon SageMaker sets the environment variables and how it invokes the script with the three hyper parameters defined in the estimator:
/usr/bin/python mnist_keras_tf.py --batch-size 256 --epochs 20 --learning-rate 0.01 --model_dir s3://sagemaker-eu-west-1-123456789012/sagemaker-tensorflow-scriptmode-2019-05-16-14-11-19-743/model
Because you saved your model in TensorFlow Serving format, Amazon SageMaker can deploy it just like any other TensorFlow model by calling the deploy() API on the estimator. Finally, you can grab some random images from the dataset and predict them with the model you just deployed.
Script mode makes it easy to train and deploy existing TensorFlow code on Amazon SageMaker. Just grab those environment variables, add command line arguments for your hyperparameters, save the model in the right place, and voilà!
Switching to the Apache MXNet backend
As mentioned earlier, Keras also supports MXNet as a backend. Many customers find that it trains faster than TensorFlow, so you may want to give it a shot.
Everything discussed above still applies (script mode, etc.). You only make two changes:
Use channels_first.
Save the model in MXNet format, creating an extra file (model-shapes.json) required to load the model for prediction.
For more information, see the mnist_keras_mxnet.py training code for MXNet.
You can find the Amazon SageMaker steps in the notebook. Apache MXNet uses virtually the same process I just reviewed, aside from using the MXNet estimator.
Automatic model tuning on Keras
Automatic model tuning is a technique that helps you find the optimal hyperparameters for your training job, that is, the hyperparameters that maximize validation accuracy.
You have access to this feature by default because you’re using the built-in estimators for TensorFlow and MXNet. For the sake of brevity, I only show you how to use it with Keras-TensorFlow, but the process is identical for Keras-MXNet.
First, define the hyperparameters you’d like to tune, and their ranges. How about all of them? Thanks to script mode, your parameters are passed as command line arguments, allowing you to tune anything.
hyperparameter_ranges = { 'epochs': IntegerParameter(20, 100), 'learning-rate': ContinuousParameter(0.001, 0.1, scaling_type='Logarithmic'), 'batch-size': IntegerParameter(32, 1024), 'dense-layer': IntegerParameter(128, 1024), 'dropout': ContinuousParameter(0.2, 0.6) }
When configuring automatic model tuning, define which metric to optimize on. Amazon SageMaker supports predefined metrics that it can read automatically from the training log for built-in algorithms (XGBoost, etc.) and frameworks (TensorFlow, MXNet, etc.). That’s not the case for Keras. Instead, you must tell Amazon SageMaker how to grab your metric from the log with a simple regular expression:
objective_metric_name = 'val_acc' objective_type = 'Maximize' metric_definitions = [{'Name': 'val_acc', 'Regex': 'val_acc: ([0-9\.]+)'}]
Then, you define your tuning job, run it, and deploy the best model. No difference here.
Advanced users may insist on using early stopping to avoid overfitting, and they would be right. You can implement this in Keras using a built-in callback (keras.callbacks.EarlyStopping). However, this also creates difficulty in automatic model tuning.
You need Amazon SageMaker to grab the metric for the best epoch, not the last epoch. To overcome this, define a custom callback to log the best validation accuracy. Modify the regular expression accordingly so that Amazon SageMaker can find it in the training log.
For more information, see the 02-fashion-mnist notebook.
Conclusion
I covered a lot of ground in this post. You now know how to:
Train and deploy Keras models on Amazon SageMaker, using both the TensorFlow and the Apache MXNet built-in environments.
Use script mode to use your existing Keras code with minimal change.
Perform automatic model tuning on Keras metrics.
Thank you very much for reading. I hope this was useful. I always appreciate comments and feedback, either here or more directly on Twitter.
About the Author
Julien is the Artificial Intelligence & Machine Learning Evangelist for EMEA. He focuses on helping developers and enterprises bring their ideas to life. In his spare time, he reads the works of JRR Tolkien again and again.
      Source link
Source/Repost=> http://technewsdestination.com/train-and-deploy-keras-models-with-tensorflow-and-apache-mxnet-on-amazon-sagemaker/ ** Alex Hammer | Founder and CEO at Ecommerce ROI ** http://technewsdestination.com
0 notes