#How can I check file size in Python?
Explore tagged Tumblr posts
Text
How to back up your Tumblr blog
Not sure if all of you heard the news, but Wordpress laid off 16% of its staff, which happened to include senior tumblr staff like cyle. According to 3liza, the amount of staff running tumblr is about 25.
Welp. Will Tumblr finally die? I don't know. It's pretty likely, since this site costs millions to run and to host all this content, but I'll stay till the end. But I backed up my blog, with the help of a post that can't be reblogged rn.
you can reblog this one though.
Quoth butchlinkle: "In your blog settings you have the ability to initiate a blog export, and this will generate a backup for your blog.
Fair warning though, if you’ve been on the platform for a long time this archive is likely to be quite hefty in file size. This blog I have had for 5 years with 22k posts, and the export from tumblr came to be 48GB. My previous blog I made in 2011 and has 95k posts, so needless to say I did not use tumblr’s built in export to back that one up.
If you want more control over exactly what you back up from your blog, I recommend that you use tumblr-utils instead. It allows you to backup specific tags, post types, and to ignore posts that you did not create (reblogs where you’ve added a comment count unfortunately do not count unless you use the older version of the script made with python 2.7).
To use it:
download and install python
create an application on tumblr to get an api key
create a folder where you would like to save your backups and right click to open it in the terminal/command prompt, or type cmd.exe in the address bar from inside that folder
Backing up just my original posts from this blog with this command came to 632MB rather than 48GB, and also gave me the option to save my posts in JSON format which will be useful for converting my posts to a new format for self hosting.
On that note I’m currently looking into figuring out a simple (and ideally free) way of self hosting a static site blog that utilises activitypub, and also converting my old posts to re-host on said blog.
This post series by maho.dev on implementing activitypub with any static site is my primary source of guidance atm if you also want to try figure that out yourself, as well as having an explanation for why you’d even want to do this if you don’t already know
but if tumblr goes down before I get things sorted and write up a post about it then i’ll be reporting back on it via my bsky, mastodon, and toyhouse accounts
if you dont have an account on any of these I’ll also be sharing an update via my personal site’s RSS feed, link of which includes an explanation of what RSS is and some feed readers you can use, I highly recommend checking it out as getting a feed reader is going to be the best way you can stay connected with people if they scatter across the internet!
tldr: download tumblr-utils to backup your blog more efficiently, introduce yourself to RSS and get a feed reader to stay connected with people, consider saving mine so you can find out how to self host your blog later if tumblr goes down."
here's a guide from the notes: https://docs.google.com/document/u/0/d/1yBWlk-yEgpSoEh3c9oLhz_kbLtUGqbqzOpCtJsvQgjI/mobilebasic?pli=1#h.u9vj7pezwpcy
Back up those blogs. This was way faster than trying to use Webarchive, and webarchive seems to be only good for saving text, audio, and video, because it saved none of the images. And remember: I did not write this guide, and I do not know a thing about coding or fixing bugs.
8 notes
·
View notes
Text
Top 10 ChatGPT Prompts For Software Developers

ChatGPT can do a lot more than just code creation and this blog post is going to be all about that. We have curated a list of ChatGPT prompts that will help software developers with their everyday tasks. ChatGPT can respond to questions and can compose codes making it a very helpful tool for software engineers.
While this AI tool can help developers with the entire SDLC (Software Development Lifecycle), it is important to understand how to use the prompts effectively for different needs.
Prompt engineering gives users accurate results. Since ChatGPT accepts prompts, we receive more precise answers. But a lot depends on how these prompts are formulated.
To Get The Best Out Of ChatGPT, Your Prompts Should Be:
Clear and well-defined. The more detailed your prompts, the better suggestions you will receive from ChatGPT.
Specify the functionality and programming language. Not specifying what you exactly need might not give you the desired results.
Phrase your prompts in a natural language, as if asking someone for help. This will make ChatGPT understand your problem better and give more relevant outputs.
Avoid unnecessary information and ambiguity. Keep it not only to the point but also inclusive of all important details.
Top ChatGPT Prompts For Software Developers
Let’s quickly have a look at some of the best ChatGPT prompts to assist you with various stages of your Software development lifecycle.
1. For Practicing SQL Commands;
2. For Becoming A Programming Language Interpreter;
3. For Creating Regular Expressions Since They Help In Managing, Locating, And Matching Text.
4. For Generating Architectural Diagrams For Your Software Requirements.
Prompt Examples: I want you to act as a Graphviz DOT generator, an expert to create meaningful diagrams. The diagram should have at least n nodes (I specify n in my input by writing [n], 10 being the default value) and to be an accurate and complex representation of the given input. Each node is indexed by a number to reduce the size of the output, should not include any styling, and with layout=neato, overlap=false, node [shape=rectangle] as parameters. The code should be valid, bugless and returned on a single line, without any explanation. Provide a clear and organized diagram, the relationships between the nodes have to make sense for an expert of that input. My first diagram is: “The water cycle [8]”.
5. For Solving Git Problems And Getting Guidance On Overcoming Them.
Prompt Examples: “Explain how to resolve this Git merge conflict: [conflict details].” 6. For Code generation- ChatGPT can help generate a code based on descriptions given by you. It can write pieces of codes based on the requirements given in the input. Prompt Examples: -Write a program/function to {explain functionality} in {programming language} -Create a code snippet for checking if a file exists in Python. -Create a function that merges two lists into a dictionary in JavaScript.
7. For Code Review And Debugging: ChatGPT Can Review Your Code Snippet And Also Share Bugs.
Prompt Examples: -Here’s a C# code snippet. The function is supposed to return the maximum value from the given list, but it’s not returning the expected output. Can you identify the problem? [Enter your code here] -Can you help me debug this error message from my C# program: [error message] -Help me debug this Python script that processes a list of objects and suggests possible fixes. [Enter your code here]
8. For Knowing The Coding Best Practices And Principles: It Is Very Important To Be Updated With Industry’s Best Practices In Coding. This Helps To Maintain The Codebase When The Organization Grows.
Prompt Examples: -What are some common mistakes to avoid when writing code? -What are the best practices for security testing? -Show me best practices for writing {concept or function} in {programming language}.
9. For Code Optimization: ChatGPT Can Help Optimize The Code And Enhance Its Readability And Performance To Make It Look More Efficient.
Prompt Examples: -Optimize the following {programming language} code which {explain the functioning}: {code snippet} -Suggest improvements to optimize this C# function: [code snippet] -What are some strategies for reducing memory usage and optimizing data structures?
10. For Creating Boilerplate Code: ChatGPT Can Help In Boilerplate Code Generation.
Prompt Examples: -Create a basic Java Spring Boot application boilerplate code. -Create a basic Python class boilerplate code
11. For Bug Fixes: Using ChatGPT Helps Fixing The Bugs Thus Saving A Large Chunk Of Time In Software Development And Also Increasing Productivity.
Prompt Examples: -How do I fix the following {programming language} code which {explain the functioning}? {code snippet} -Can you generate a bug report? -Find bugs in the following JavaScript code: (enter code)
12. Code Refactoring- ChatGPt Can Refactor The Code And Reduce Errors To Enhance Code Efficiency, Thus Making It Easier To Modify In The Future.
Prompt Examples –What are some techniques for refactoring code to improve code reuse and promote the use of design patterns? -I have duplicate code in my project. How can I refactor it to eliminate redundancy?
13. For Choosing Deployment Strategies- ChatGPT Can Suggest Deployment Strategies Best Suited For A Particular Project And To Ensure That It Runs Smoothly.
Prompt Examples -What are the best deployment strategies for this software project? {explain the project} -What are the best practices for version control and release management?
14. For Creating Unit Tests- ChatGPT Can Write Test Cases For You
Prompt Examples: -How does test-driven development help improve code quality? -What are some best practices for implementing test-driven development in a project? These were some prompt examples for you that we sourced on the basis of different requirements a developer can have. So whether you have to generate a code or understand a concept, ChatGPT can really make a developer’s life by doing a lot of tasks. However, it certainly comes with its own set of challenges and cannot always be completely correct. So it is advisable to cross-check the responses. Hope this helps. Visit us- Intelliatech
#ChatGPT prompts#Developers#Terminal commands#JavaScript console#API integration#SQL commands#Programming language interpreter#Regular expressions#Code debugging#Architectural diagrams#Performance optimization#Git merge conflicts#Prompt engineering#Code generation#Code refactoring#Debugging#Coding best practices#Code optimization#Code commenting#Boilerplate code#Software developers#Programming challenges#Software documentation#Workflow automation#SDLC (Software Development Lifecycle)#Project planning#Software requirements#Design patterns#Deployment strategies#Security testing
0 notes
Text
THIS ISSUE HAS BEEN RESOLVED!
(Source: https://modthesims.info/showthread.php?t=687747 )
TL;DR: What happened?
Two creators had unfortunately been victim to their passwords being leaked. The people who are behind these types of TS4 malware issues tend to find leaked passwords and then sharing their Trojan file.
IF you downloaded any of these 4 items in the last 24 hours: 1. No Mosaic / Censor Mod for The Sims 4 - Toddler Compatibility Update! 2. AllCheats - Get your cheats back! 3. CAS FullEditMode Always On (Updated 6/26/18) 4. Full House Mod - Increase your Household Size! [Still Compatible as of 1/25/18] Just know that they were only live for 1,5 hours. The chances that you downloaded something malware are quite low due to this. However, just to be safe, it's good to delete them anyways if you did download them 24 hours before as of this reblog post.
So: Just a reminder to, well, everyone using the internet: Make sure to change your passwords periodically! (and, if possible, use an authentication app).
As far as I know, MTS is working on making it much harder to update posts when you've been inactive for a while! So in the future, the hackers would need access to your email provider to include malware in your mods. I believe this code is already live as we speak.
How to stay safe downloading anything CC related in the future:
Know that this issue is seemingly a big issue in The sims 4 community! While the other communities are certainly not ruled out to be able to have malware in them, it seems this group of hackers are really focused on The Sims 4 community as a whole.
What files are the issue?
ts4script files. Because it's raw python AND TS4 doesn't have great restrictions for script mods in place, these people can modify the python file to create a .dll file on running the game. That's how they get information if they're lucky.
.exe files or files that look like another file type but are an .exe file. (or some executable file like a bash script, etc). MTS does check these things before approving, but do be careful when downloading these things from tumblr or github. Make sure to check the comments there instead.
What files CANNOT ever get malware in them?
Simply said: .Package files. Exception for maybe the .package files that are actually ts4script files, but that's really from the ancient TS4 days.
With other words, your: CasParts, Lots, Cosmetics, Hair, Sims, Recolours, Objects CANNOT have malware in them
The only "kind of" malware we saw back in the days in Package files was the infamous TS3 Doll corruption bug. But that didn't collect your data, just corrupted your save/game 😉
What ways can I detect if something is malware at first sight?
99% of script modders, when updating their mods, WILL add WHY they updated their mod in the first place. If you do NOT see any update reasons in the description, it's probably malware.
Check the comments! If you're not sure, always check if someone left a comment (or in Tumblr's case, a Reblog).
Trust your gut feeling! Does something seem strange? A bit out of place from the usual? Give it a few days before you download the mod.
Package files SHOULD NEVER have a way of "installing your content" through an .exe file "For simplicity", because 99% of the cases, it's malware to trick you. Unless there is a excellent reason for it (and I mean REALLY good reason).
More or less a download site related thing: If a download site has a billion buttons saying "Download". Please don't press these. They are most likely Malware too, but definitely shady ads. For those pages, it would be best to leave the item alone, unless you really know what you're doing!
Conclusion
While these discord server announcements mean well, it frustrates me to see that they mention that EVERYTHING is compromised. Whereas in reality it's only TS4Scripts and .exe files that can do harm.
I know they mean well! And wanting to protect people! But at the same time, it also spreads a sense of misinformation that can harm creators, websites, you name it.
So, instead, I would love to advise them to educate their members instead on what files can be the problem! And how to detect them. The more we get this into the world, the better we will be able to protect one another from downloading bad things!
And of course, websites that share CC, should make an effort to prevent this in the future. I'm happy MTS is doing this at the moment.
Stay safe!
(Sourced from the Sims After Dark discord server)
DO NOT DOWNLOAD ANY MODS FROM MODTHESIMS! Numerous mods there (including those by TwistedMexi) are being compromised by hackers adding a malicious file with the mods
Please reblog!!
#Signal boost#please reblog#the sims 4#ts3#ts4#sims 4#mod the sims#sims 4 community#sims community#sims 2 community#ts2 community#ts4 community#the sims 2#ts2#sims 2#mts
4K notes
·
View notes
Text
How can I check file size in Python?
The output is in bytes.
You need the st_size property of the object returned by os.stat. You can get it by either using pathlib (Python 3.4+):
>>> from pathlib import Path >>> Path(somefile.txt).stat() os.stat_result(st_mode=33188, st_ino=6419862, st_dev=16777220, st_nlink=1, st_uid=501, st_gid=20, st_size=1564, st_atime=1584299303, st_mtime=1584299400, st_ctime=1584299400) >>> Path(somefile.txt).stat().st_size 1564
or using os.stat:
0 notes
Text
To answer a couple questions that have come up recently on comments & via tags...
@clarasghosts am happy to spread the good word about minis! I've glomped my imposition code onto @momijizukamori's Bookbinder JS page. It's free & web based & hopefully easy to use. You just take a normal PDF and feed it in-- this book was the "mini" layout (under the "Wacky Small Layouts" section)
@emptyyourselfintothesky No, but they do sell them! I've an adorable miniature press from Tony Firman ($175). While he does sell a plough ($100) for it, I've opted for chisel trimming, which I talk about more in this post.
@goodnightmoonvale I've ordered it off Amazon [link]- it's not "official" bible paper, just 45 gsm sheets. Currently $13, paper size A4, 80 pages. Be warned, printing on it is a very finicky process. Have about 1 in 3 pages workout. (and even then, I tolerate some... cruft)
@this-is-surely-tru It varies... Definitely depends on the software folks use and how ornate they want to be- some folks sink a LOT of time into it. I use LaTeX which is all text (like code) and allows me to re-use large chunks from previous projects. I also have written python scripts that let me pull fic from AO3 super fast. A "normal" mini fic from AO3 can take me... 15-30 min to setup? (Import content, sanity check line breaks, generate QR code, etc) The Art of War though was a fresh layout and attempt at "design"-- time spent at computer was probably....? 3 hours? Over several days, plus pondering layout when offline. I don't track it too closely. The hard part is just knowing what it should look like. Executing on a vision is not that bad.
And yes ;) I "tolerate" the step-- the joy for me is the manual process. The mind can wander when folding, sewing, trimming... but typesetting is a mental sink hole for me where I must be Focused. But totally worth it! And every project remains on hand (in a private GitHub repo) for me to pull from next time. Am slowly working up the will to typeset Winnie-the-Poo Chapter 1 as a small book... will keep an eye on how long that takes ;) (easy enough to do if I remember to check the files into git at regular work intervals)
@promithiae Doooooooooo iiiiiiiiiit! There's lots of resources to be found over at @renegadepublishing and a rabid collection of folks on Discord who'd love to help you through the process.
(also wanted to note/celebrate that my follower count has finally caught up with my post count. That's kinda' like a milestone, yeah? Given I started posting here Dec 2013...)
128 notes
·
View notes
Note
hello! i want to start making gifs, but i don't really know where to start. what are some programs you use and any tips?
hello hello ! ah amazing we can always use more content creators <3 i'll try to point you in the right direction to get started ! under the cut bc it's long:
⏤ my first app recommendation is 4k video downloader which will let you download videos in their highest quality from youtube. i recommend starting with content like music videos as they are usually available in 1080p (the minimum high quality you want - anything less and it can be really tough to get your gifs looking smooth) and up to 4k (pretty much the best quality you'll get), and it's easy to pick out shots you like to start messing around.
⏤ when i was first learning to gif, the only other app i used was photoshop. i started with a free trial to see if i would get the hang of it and now i pay for a monthly adobe subscription, but there are definitely cracked versions out there for download - you just have to find them (check the links at the bottom of this post) 👀 i honestly don't remember what tutorial specifically i followed to get the steps down, but here is one and here is another i found with a quick search that i think are good for a beginner. if those don't work for you, you can google "how to make gifs in photoshop" and you'll be able to find a ton and choose one that suits your learning style (i prefer written step-by-step, but if videos are easier for you, there are a lot of choices out there).
⏤ as far as coloring goes, it'll take time to figure out using adjustment layers and your own style. i really like this tutorial on how selective color works and remember using it when i was first starting. that same blog has a lot of other giffing resources you can look through, too: all ps tutorials
⏤ once i had the hang of just using ps, i learned how to use vapoursynth which is a python script program that will help you resize your gifs and keep them looping smoothly. it also can denoise and sharpen your gifs if you want. the reason i don't recommend starting with it is because i think it looks overwhelming at first, but once you get the hang of it, it's simple to use and makes a big difference especially when it comes to cropping. ultimately it's totally up to you if you want to try and learn it all up front or not. this guide has all the information you'll need to install it depending on operating system, and also has guides for how to use it. it is MUCH harder to set up on a mac than windows, especially new macs, just fyi. if you are planning to gif ts files (for stage performance sets) you will need vapoursynth imo, but otherwise it's not at all a necessity, just a recommendation. i also used this tutorial to help me learn to use it.
general tumblr tips i wish i knew starting out:
⏤ the appropriate sizing for gifs on tumblr is as follows: your width should be 540px for one gif in a row, 268-268px for 2 gifs in a row, and 177-178-177px for a row of 3 (middle has to be 178 or it'll be blurry. i have no idea why. this site is insane). your length can be whatever you want but certain things just look better & if you aren't resizing in VS, then you're at the mercy of your videos dimensions when it comes to cropping them down.
⏤ the mb limit for gifs is 10 but if you're using beta post editor it's actually 9.5, and tumblr will compress the heck out of your gifs that are larger than 5mb, so just keep that in mind, i recommend only make bigger gifs with SUPER high quality videos.
other helpful resources:
⏤ this awesome post compiled by another wonderful cc friend here has links to programs and specific resources for hq kpop files
⏤ a helpful open network tag list to use for getting your gifs seen
i think that about covers it ... sorry this is a LOT of info but i hope it makes it easier to narrow down where to start. if there's anything else i can help you with, just let me know and i'll do my best !
#erimail#i hope this helps :<< pls let me know if there's anything i can explain better !#it can be overwhelming at first but if you really want to learn it's super fun and worthwhile so don't be discouraged#we're here to support you !#chuuchuutrainnn#gif help#.resource tag
26 notes
·
View notes
Text
BUT IF YOU TALK TO INVESTORS, YOU SHOULD FOCUS YOUR WHOLE ATTENTION ON IT SO YOU CAN SAY THINGS YOU WOULDN'T SAY IN CONVERSATION
My advice is generally pessimistic. October 2007 After the last talk I gave, one of our teachers overheard a group of sufficiently smart and determined founders succeeding on that scale for any language that gives hackers what they want by themselves. The math paper is hard to ignore. In 2000 we practically got a controlled experiment to prove it, because it doesn't feel like procrastination. Because he pays close attention, a Navy pilot can land a 40,000 lb. Not all of them, but because it is the people. Why would great programmers want to work in the end.
The kind of question on the application. The result was that I couldn't talk to them about what they really mean, in 1958, and popular programming languages are equivalent is false than designing languages. These range from make-believe, which is not really about you. Why? So maybe I'll try not bringing books on some future trip. File:///home/patrick/Documents/programming/python%20projects/UlyssesRedux/corpora/unsorted/before. A huge step, admittedly, and one that we wrote in order to seem smarter. The test drive was the way they taught me to in college. So despite the huge number of software patents generally. Our bodies weren't designed to be a company of any size to get software written faster was to use a high estimate when fundraising to add a few more checks on public companies. But this isn't true. Well, obviously overtly sexy applications like stealth planes or special effects software would be interesting to start viewing startup ideas this way, you tend to be pushing the limits of how little they needed them.
But vice versa as well. There is no rational way to value an early stage startup grows mostly because the founders don't devote their whole efforts to them. Some will be justified and some bogus, but unless taxes are high enough to discourage people from creating wealth, certainly. And that's what you were building, you've created a broken company. Over time the two inevitably meet, but not totally unlike your other friends. In this new world. But actually being good is that she hates bragging. The most interesting question here may be what high res fundraising will do to the world, at least not too constricting.
But if you control the whole system and have the source code too. Web-based applications. If languages are all equivalent, sure, you might be able to explain in one sentence each what they lack is an overall discipline for combining evidence. In Russia they just kill you, they assume there must be a reason. They'll send you emails saying they want to buy you, because hackers would already be the future price, and there would be no rest for them till they'd signed up. When you demo, don't run through a catalog of features. How to Make Wealth May 2004 This essay was originally published in Hackers & Painters, what you get.
This was not how we saw it at the time, though. And this national standardization of wages was so pervasive that its effects could still be seen years after the war ended. Unfortunately, t is still very far from infinity. The angel agrees to invest at a $3 million cap. A few months ago an article about Y Combinator said, Once you take several million dollars. And compared to the last, discarded fashion, there is no cost to using uncommon technologies. And that statistic is probably not worth trying to write Great Literature? You release software as a series of meetings, culminating in a full partner meeting. If you write software in house.
#automatically generated text#Markov chains#Paul Graham#Python#Patrick Mooney#evidence#years#programmers#Once#teachers#October#step#kind#way#books#effects#Wealth#estimate#friends#talk#scale#technologies#patents#wages#stage#range#meet#vice#code
343 notes
·
View notes
Text
Okay yes hi hello this is me gracing y’all with my writing Bc I’ve had this idea forever!! This is going to be multiple chapters, here is chapter two. Enjoy :)
~
Technical Analyst (ch.1)
~
Short description: Spencer works as a technical analyst alongside Garcia and Kevin, though he hasn’t ever really worked directly with the BAU team, he works more in filing and researching. But when Garcia goes on vacation leave, and Kevin is busy with his own work, Spencer steps up to help- and that’s when he meets Derek Morgan.
———————————————————————
Spencer hated technology. He hated computers, tablets, cell phones, he hated it all. He hated everything and anything that isn’t on printed onto paper. So how the fuck did he end up as a technical analyst- whose entire job was based around proficient use of technology? In very short, budget cuts.
He originally worked in domestic terrorism, though he never fit in well there. He was a good worker, fast and able to do a lot. But his coworkers never let him feel included. He would hear them make plans without him, ignore him in conversations, only reaching out to him for his great memory to help solve a case. It was dehumanizing. He was just a brain for them, nothing more.
Then, the budget cuts came. And he got removed from the team, as he had the least amount of hours in the field- which wasn’t his fault. The rest of his team always forced him into the research position, so while they were off chasing the bad guys, he was stuck researching with a computer he doesn’t trust.
So yeah, he wasn’t an asset to them. But the bureau knew a mind like his in general was an asset, a fountain they’d like to keep a tap on. So they made work for him. It was mostly menial. He would assist with intense cases when necessary, but even then it was just research. No one knew what he would be like in the field, because they never gave him the chance.
Spencer tried not to think about how unfair this was, how stupid and purely tedious it was. He would rather be working as a T.A. at this point- which wouldn’t even be that bad. At least he gets heard and seen then.
~
Spencer’s normal day consists of going from his apartment to the bureau building, to directly into his cramped little office that was about the size of a jumbo walk in closet. A nice size to store clothes, but not so nice when you have to have a person, a desk, a chair, three computer monitors, two filing cabinents, a trash can, a fax machine, and a printer all crammed in there.
Yeah, his workplace was entirely too small. Thankfully it didn’t impact his ability to work, though, most the time Spencer finished his work quickly; and would end up reading. Spencer didn’t venture out from his office that much at all, (he always brought his own coffee so he didn’t have to worry about bugging the field agents.) the exception to leaving his office was to go across the hall to Penelope Garcia, his only sort of friend that he had at work. She was always so bubbly, it was a breath of relief for him to go see her- she reminded him of all the positive things, he definitely couldn’t do the job without her.
Not to mention, she had to train him from starting point zero. Spencer hated technology, after all. So he never made an effort to learn coding, hacking, how to re-route and track things. He knew nothing like that, hell, he struggles with his cellphone turning on sometimes.
Thankfully, she was able to get some sense into him, and he was pretty good at what he could do. Though he was still working out python coding, he was enjoying the learning process of using technology.
That being said- he still despises technology, and he hopes that once he leaves the job, he can throw away his very unnecessary but work mandated laptop.
~
Spencer made his way into the bureau building, messenger bag slung over his shoulder awkwardly as a thermos of coffee was held tightly in his right hand, while the left one reached for the door handle to enter. He got in no problem, security didn’t stop him anymore, thankfully. Though in the beginning, they did check him constantly, verifying that he belonged there. After all, he looked young, and he definitely didn’t belong in the bureau building. But then again, Garcia didn’t look like she belonged there either.
Security just made presumptions about people, he shrugged that thought off as he made his way to the elevator. Thankfully no one else was in there, he pressed the button for floor six, and the elevator doors shut.
The elevator whirred to life, taking him up to the sixth floor slowly. Thankfully today was a slow day, there wasn’t really any important case he had to work on. (Not like he ever really got given cases to work on, anyways.) So Spencer was hoping he would be able to finish his work quickly, as he had some books he brought with him that he wanted to read and re-read before the day was finished.
The elevator dinged, a signal it had reached its necessary location, before the doors finally slid back. He stepped out, taking his usual left down the hallway immediately. Forward through the glass doors was the bullpen with the agents who worked in the BAU. And god, what he wouldn’t give to be a field agent, working as a profiler. That’s why he wanted to join the bureau, and yet he was so close- his office only down the hall. But he was simultaneously so far, not being trusted by all the bureaucratic bosses, who didn’t know if he would be a good agent to warrant being put out into the field.
He hated it, but he tried not to think about it as he reached his office, Garcia’s door was shut, she was on vacation, or so he had heard. Spencer pulled on his office door, entering with ease as he moved into the cramped workspace.
Spencer sat his messenger bag down onto his desk, sitting himself down in his office chair and taking a minute to breathe in and out before continuing. Spencer hated this job. It was mind numbingly boring, he was so close to quitting. He knew the bureau would fight tooth and nail to keep him, however, but if that was the case, why not give him a better job- he didn’t want a nicer office, he wanted to help people.
He sighed, today was just one of those days where he was extra mad about not being treated right, he tried to ignore this thought process as he got ready to work; setting his coffee down by his computer mouse to his right, setting his messenger bag onto the floor next to him, pulling off the scarf that was wrapped loosely around his neck and hanging it over the back of his chair. Now he was ready for the day.
~
Penelope didn’t mean to forget to tell the team that she was going to be gone- she assumed they knew. At least Hotch did, all the rest of them knew was that she was going to take a week off to relax, they just didn’t know when (she had too many vacation days saved up, so she had to use them or lose them. She chose the former.) It was just a total brain fart moment on her part, so while she decided to hit up her favorite stores, spas, and websites; the team had no idea, they assumed she was holed up in her office, hacking away at whatever she normally does.
This would only show itself when Derek needed her, calling her office number and it going to voicemail “Hi, this is Penelope Garcia with the FBI and I’m too awesome to come to the phone right now, if it’s an urgent matter please call Aaron Hotchner-“ yeah, Derek hung up his phone by then, deciding to call her personal cell.
“Hi, hot chocolate!” She answered cheerfully, the sounds of people talking and laughing could be heard in the background, which Derek took note of. “Babygirl- your work phone sent me to voicemail, where are you?” Garcia was quiet for a second, before practically blowing Morgan’s eardrums out; “Oh- damnit! I knew I was forgetting something!” “Care to fill me in?” He asked her curiously, “Yes-“ Garcia sighed before continuing on, “Sorry. I’m taking those vacation days Hotch told me I had to use or else I’d lose.”
“So you’re not at the office.” He stated, “That I am not, I’m sorry I forgot to tell you! But my pal Spencer Reid should be covering for me.” “Spencer Reid?” Derek asked, unfamiliar with that person, “Why not kevin?” “Ugh, I don’t know- he’s doing that thing where he’s actually busy with other work for once. But Spencer is good, I taught him everything he knows- and I’m pretty sure he’s got three PhDs, so yeah, you replaced one genius with another- so don’t worry!” “Okay, well...” Derek took a second, “You sure I can ask Spencer about everything I’d ask you?” He meant work related, within being able to hack and get everything that Garcia would be able to get. Because Morgan knew that her talents were very special, and having someone else replicate them seemed near impossible, so he was a bit hesitant to trust someone new.
“Oh yeah- he’ll find everything easy peasy lemon squeezy. Don’t worry yourself, sugar.” “Okay, thank you mama. Have a good week of rest.” “I will! I have an appointment for a spa, and oh my god Derek- they do a seaweed wrap thing, isn’t that crazy?” “So you’re gonna get rolled up like sushi?” “No! Ew! Don’t compare me to raw fish!”
The phone call continued for a bit after that, as Derek wasn’t in an urgent matter. It was just a filing day at the office, before he hung up he asked where Spencer was, though; “Oh, he’s in the office next to mine, across the hall!” Garcia told him happily. Derek had thought that was a storage closet, but he didn’t tell her- instead thanking her and hanging up.
Now to pay this mystery computer whiz a visit.
~
Spencer was in the middle of re-routing a bunch of information that Garcia needed to send to her boss, Aaron Hotchner. Spencer didn’t share the same boss, since he was technically working in a more basic division of the bureau, he instead answered to Strauss- which was a royal pain in the ass, but he always turned his work in on time, came in when needed, he had never had to face her wrath yet, thankfully.
Spencer typed away, trying to get all the data to get to Hotchner as quickly as possible so he didn’t have to wait, though it wasn’t crucial the work did get completed right now. Spencer just liked to get things done.
A knock sounded Spencer out of his methodical typing, it wasn’t Garcia, obviously. And he knew Kevin was in a meeting right now with some IT people over his keyboard acting funky (Kevin could fix it by himself, but office administration forced him into talking to IT.)
“Yes?” Spencer asked curiously, turning around in his office chair, because he had no clue who it was that could be interrupting his work. The door pushed open, revealing a tall, classically handsome, muscular man carrying some files in his hands. Fuck, that would be Spencer’s luck. An attractive guy swooping in and making his IQ of one hundred and eighty seven go down to sixty in two second flat
“Hi- you Spencer?” The man asked, stepping forward into the cramped office. Spencer stood up instinctively, “Yes, I am. How can I help you?” The man handed the files over awkwardly, “I’m sorry, I usually ask Penelope Garcia for this but she’s on vacation and she referred me to you- I just need these put through VICAP, I’m not too familiar with the system as a whole, ‘cause Garcia usually handles it.”
Spencer nodded, taking the files and looking through them briefly, there were nine of them. “I’m sorry, I know that’s a lot of work to do... I’m sure I can figure it out myself-“ Derek started, doing his best to apologize. Little did he know Spencer could get this done within an hour or so.
“Oh no- not a problem at all, this should only take me about an hour, two at most, but that’s a generous estimate.” Derek raised his eyebrows, “An hour or two? Garcia usually finishes up this many files within three or four. How are you able to get this done faster than her?”
“I have an eidetic memory, which helps me recall anything that I read. I can read these files once and put all the information into VICAP knowing it’s accuracy is one hundred percent without having to double check, that cuts down my speed by half per case file.”
Derek looked confused and shocked. Yeah, Spencer could understand why. “Sorry, um. That’s a weird explanation, but it shouldn’t take me as long. I’m assuming you’re out in the bullpen?” Spencer asked him, putting the files down atop his keyboard.
“Yeah, I’m Derek Morgan with the BAU.” Derek finally introduced himself, reaching his hand out. Shit, this was Derek Morgan? Garcia has mentioned him a few times to Spencer, saying he’d love him “oh he’s so handsome, but so sweet and loving, like the hottest man on earth- I’d marry him in a heartbeat, but we don’t roll like that, Y’know?” That’s how she described him once, and of course Spencer remembered that word for word. Spencer felt like it was just his luck, that his only work colleague was best friends with a man so attractive that his mind isn’t working fully.
Not to mention he was in the BAU, Spencer guessed he was, since Garcia was their technical analyst. But still, it would be just his luck to know this insanely attractive man was part of the team he wanted to belong to so bad. Spencer wasn’t sure how to respond as he kept his composure. After all, yeah, Derek was attractive. But they probably wouldn’t speak again after this exchange. It wasn’t worth Spencer thinking about him, or how Garcia described him.
“I’m sorry, I don’t shake. But it’s nice to meet you, I’ll find you once I’m done. If you need anymore help, feel free to let me know.” Spencer told him, looking back at the files on his desk as a distraction away from this hot guy that was just standing so calmly in his office, as if Spencer ever had any visitors into the cramped space besides Garcia and Kevin.
By the time spencer looked back up, Derek’s arm was back down by his side. “Okay, thank you.”
~
Derek was surprised by their exchange, to say the least. How did he not know about this genius before? How was he not more well known, a memory thing, three PhD’s- that would be a useful asset? How come he was hidden away in a closet sized office? He had to know more. Even if it was nosy and stupid.
Normally, he’d call Garcia and ask her if it was about an employee. But in this case, he couldn’t. And he couldn’t go to Spencer, that would be weird.
So, he did the next best thing. He asked Hotch.
~
He knocked slowly on Hotchner’s door, hoping he wasn’t going to tell him to mind his business and not ask about employee facts when they definitely were irrelevant.
Derek was smart though, he figured out a foolproof way to play this. So when Hotch said, “Yes?” He came in, starting his plan into motion.
“Hotch, where’s Garcia?” He asked him, as if Derek hadn’t immediately checked up on his babygirl when he couldn’t find her. “Oh,” Hotch started, setting a file down that he had been looking over, “She took some vacation time.”
“So, who am I supposed to go to for computer help?” Derek asked, “Well,” Hotchner started, matter of factly, while he reached for a thin, unopened file on his desk. “We have a new guy helping us. Kevin’s busy with helping the child abduction unit reset their computers, as well as he’s in an IT meeting right now, so we have..” Hotch stopped, looking down to read the name off the file; “Doctor Spencer Reid. I’m sure he’ll be just as good.”
“Hotch. No ones as good as Garcia.” Derek pointed out, Hotch shrugged. “Maybe not. But this guy has a glowing personal history- and Garcia told me she taught him everything he knows.”
“What’s his personal history?” Derek asked curiously, stepping a bit closer but still trying to play nonchalance. “You know I’m not able to disclose that. You can go ask him for yourself.” Derek sighed. Of course Hotch wasn’t gonna tell him shit. He should’ve expected this. But sue him, call him hopeful. He was hoping he could’ve gotten some information on this mysterious doctor.
~
Derek made his defeated way back to his desk in the bullpen. And Emily, whose desk was directly across from his, immediately noticed his slight annoyance at Hotch. So she asked in a hushed voice as soon as he sat down;
“Did you get yelled at by Hotch?” Because in her mind, that was the most logical explanation that made the most sense. Derek just shook his head as a response, “No,” he clarified, “I was asking about our Garcia fill-in, and Hotch wouldn’t tell me anything.”
“Garcia fill-in? She’s gone?” Emily asked confusedly looking back to the hallway that led to Penelope’s office, as if she’d magically appear. “Yeah, but just for the week.” Derek explained, “She’s using those vacation days she had saved up. And Kevin isn’t our standby, ‘cause he’s busy. Instead it’s some new guy.”
“Who?” Prentiss asked, this time she was curious. And as if on cue, Dr. Spencer Reid came through the glass doors, and into the bullpen, carrying Morgan’s stack of files.
“Him.” Morgan pointed back simply as a response as he waved Spencer over.
~
To say Spencer felt out of his element by being in the BAU bullpen was an understatement, he felt like a fish out of water. Like he was suffocating and everything around him was too much.
He purposely avoided the bullpen, first reason being because he didn’t have any work with the BAU. But the second reason was he knew if he stepped in, he’d be more upset that he couldn’t be on the team. And the last thing he wanted to do was make his job worse for himself.
But, this experience was an outlier. And though Spencer can remember almost anything and everything, he planned on doing his best to purposely forget all of this. Every last detail.
He wasn’t going to let himself remember how there were field agents with real life guns holstered at their sides, how they were all sitting casually, looking over cases and drinking coffee, how they had the title of SSA (he only had SA, which he still was bitter about.), and then how at a moments notice they could fly away in a jet. How astonishing their work is, how jealous he is.
But Spencer entered through the glass doors nonetheless, looking around quickly before seeing Derek wave him over. Derek was sat at his desk, talking to a woman whose head was turned away from Spencer, all he could see was that she was his desk mate, and that she had black hair.
Spencer made his way over at a brisk pace, he just needed to get in and out. If he stayed for too long, he’d let himself remember to much.
“Hey, I- I got these into VICAP no problem,“ Spencer started as he handed Derek the case files, “But I noticed some errors on the date stamping on when you found the unsub so I corrected it myself, I hope you don’t mind.”
Derek shook his head casually, “Not a problem at all, I have a habit of messing that up. Thanks doc.” Fuck, ‘doc’? Spencer hadn’t been called ‘doctor’ in months, let alone ‘doc’. This was turning into a tailspin moment for him as he smiled awkwardly, feeling a blush rising to his face, he wasn’t sure what else to do. But he wanted to get out of there.
Thankfully, the woman with black hair introduced herself, as once he had rounded the corner to see Derek, he also saw her face. She was pretty, and had bangs. “Hi, I don’t think we’ve met. I’m Emily Prentiss.” She reached her hand over to shake Reid’s expectantly, “Oh I-“ Reid started, hands down at his sides, he wasn’t going to move them.
“He doesn’t shake, Prentiss.” Derek explained casually, “Oh,” Emily said, dropping her hand down, “Sorry! It’s still good to meet you, though. So I hear you’re covering for Garcia?” She asked Spencer, who nodded as he pushed a piece of hair back behind his ear.
“Yeah she’s taking vacation time, and Kevin is currently busy with helping the child abduction unit. So I’ll be you technical analyst for the next week or so.”
“I’m sorry, but how long have you been with the bureau? You look really young. I don’t mean to be rude I’m just-“ “You’re really asking him the rudest possible question, though, huh?” Derek joked to her, and she just smacked him on the arm lightly before turning her attention back to Spencer.
“No you’re fine to ask I- um, I’ve been with the bureau a year and a half, but originally I was on the domestic terrorism field unit.” He explained shortly, he didn’t wanna go into how he got on the bureau to begin with, or how he left the domestic terrorism unit. All he wanted to do was have this conversation end, or else it would just be that much harder to forget.
“Domestic terrorism? So how do you end up doing technical analyst work?” Derek butted in curiously, up until now it has been Prentiss asking all the questions.
Spencer stayed quiet for a moment, before finally responding, “If you need anything else, my office is next to Garcia’s. It’s been nice meeting you, Emily.” All he gave to Derek was a curt nod before walking out at the brisk pace he had entered with.
~
“Wow, well you fucked that up.” Prentiss spoke to Derek once she saw Spencer exiting through the glass doors, and turning down the hallway.
He sighed and rolled his eyes at her, “I’m just curious about him, can you blame me?” Emily just chuckled softly in return, shaking her head as she turned her chair around to face him more head on.
“Are you curious about him because he’s cute, or because he’s replacing Garcia for the week?” Derek blinked at her in surprise; “I never said he was cute.” He protested, more confused than anything else.
“You didn’t say it, but your body language did. You think he’s cute. You called him ‘doc’ and he almost blushed, and I have a feeling you’re gonna try and call him ‘doc’ again to see that same result- and you watched him the entire time, even if I was talking.”
“You think random bureau agents are cute all the time, what’s it matter?” Derek rebutted, trying to deflect and ignore, because Prentiss wasn’t making sense. Derek wasn’t attracted to Spencer, he didn’t think he was cute. Spencer’s level of attractiveness had nothing to do with his curiosity.
Derek did have a right to be curious for other reasons, anyways. This guy was replacing Garcia for a bit. It made sense Derek would wanna know more about the guy, even if he was or wasn’t attractive.
“Yeah, I find agents cute. But I don’t go asking Hotch about them.” Prentiss said with a smirk, Derek just shot her a glare. “I asked Hotch because he’s replacing Garcia. And I’ve not heard of the guy before.”
“Whatever you say, man.” Was all Emily replied with as she turned back to her work, Derek just rolled his eyes at her again before turning to his own computer.
Okay, so he knew Spencer was in domestic terrorism. It couldn’t hurt to just search it up, right? It wasn’t anything classified, he’d be able to see it, Derek hoped. He wasn’t meaning to be nosy, but he was just so curious and confused. He just had to know more.
———————————————————————
#fanfiction#criminal minds#cm#imagine#prompt#spencer reid#derek morgan#moreid#aaron hotchner#emily prentiss#Penelope garcia#kevin lynch#Dave rossi#Jason gideon#jennifer jereau#jeniffer jareau#jj#Tara lewis#luke alvez#matt Simmons#multiple chapters#og shit#Spencer Specific Fics#fanfic#oneshot
104 notes
·
View notes
Text
Classification Decision Tree for Heart Attack Analysis
Primarily, the required dataset is loaded. Here, I have uploaded the dataset available at Kaggle.com in the csv format.
All python libraries need to be loaded that are required in creation for a classification decision tree. Following are the libraries that are necessary to import:
The following code is used to load the dataset. read_csv() function is used to load the dataset.
column_names = ['age','sex','chest pain','resting blood pressure','cholestrol','fasting blood sugar','resting ecg','max heart rate','excercise included','old peak','slp','caa','THALL','output']
data= pd.read_csv("heart.csv",header=None,names=column_names)
data = data.iloc[1: , :] # removes the first row of dataframe
Now, we divide the columns in the dataset as dependent or independent variables. The output variable is selected as target variable for heart disease prediction system. The dataset contains 13 feature variables and 1 target variable.
feature_cols = ['age','sex','chest pain','chest pain','resting blood pressure','cholestrol','fasting blood sugar','resting ecg','max heart rate','excercise included','old peak','slp','caa','THALL']
pred = data[feature_cols] # Features
tar = data.output # Target variable
Now, dataset is divided into a training set and a test set. This can be achieved by using train_test_split() function. The size ratio is set as 60% for the training sample and 40% for the test sample.
pred_train, pred_test, tar_train, tar_test = train_test_split(X, y, test_size=0.4, random_state=1)
Using the shape function, we observe that the training sample has 181 observations (nearly 60% of the original sample) and 10 explanatory variables whereas the test sample contains 122 observations(nearly 40 % of the original sample) and 10 explanatory variables.
Now, we need to create an object claf_mod to initialize the decision tree classifer. The model is then trained using the fit function which takes training features and training target variables as arguments.
# To create an object of Decision Tree classifer
claf_mod = DecisionTreeClassifier()
# Train the model
claf_mod = claf_mod.fit(pred_train,tar_train)
To check the accuracy of the model, we use the accuracy_score function of metrics library. Our model has a classification rate of 58.19 %. Therefore, we can say that our model has good accuracy for finding out a person has a heart attack.
To find out the correct and incorrect classification of decision tree, we use the confusion matrix function. Our model predicted 18 true negatives for having a heart disease and 53 true positives for having a heart attack. The model also predicted 31 false negatives and 20 false positives for having a heart attack.
To display the decision tree we use export_graphviz function. The resultant graph is unpruned.
dot_data = StringIO()
export_graphviz(claf_mod, out_file=dot_data,
filled=True, rounded=True,
special_characters=True,class_names=['0','1'])
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
graph.write_png('heart attack.png')
Image(graph.create_png())
To get a prune graph, we changed the criterion as entropy and initialized the object again. The maximum depth of the tree is set as 3 to avoid overfitting.
# Create Decision Tree classifer object
claf_mod = DecisionTreeClassifier(criterion="entropy", max_depth=3)
# Train Decision Tree Classifer
claf_mod = claf_mod.fit(pred_train,tar_train)
#Predict the response for test dataset
tar_pred = claf_mod.predict(pred_test)
By optimizing the performance, the classification rate of the model increased to 72.13%.
By passing the object again into export_graphviz function, we obtain the prune graph.
From the above graph, we can infer that :
1) individuals having cholesterol less than 338 mg/dl, age less than or equal to 70.5 years, and whose previous peak was less than or equal to 1.55: 84 of them are more likely to have a heart attack whereas 42 of them will less likely to have a heart attack.
2) individuals having cholesterol less than 338 mg/dl, age less than or equal to 70.5 years, and whose previous peak was more than 1.55: 6 of them will less likely to have a heart attack whereas 38 of them are more likely to have a heart attack.
3) individuals having cholesterol less than 338 mg/dl and age less than or equal to 76.5 years: are less likely to have a heart attack
4) individuals having cholesterol less than 338 mg/dl and age more than 76.5 years: are more likely to have a heart attack
5) individuals having cholesterol more than 338 mg/dl : are less likely to have a heart attack
The Whole Code:
from google.colab import files uploaded = files.upload()
import pandas as pd from sklearn.tree import DecisionTreeClassifier # Import Decision Tree Classifier from sklearn.model_selection import train_test_split # Import train_test_split function from sklearn.metrics import classification_report import sklearn.metrics #Import scikit-learn metrics module for accuracy calculation from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO from IPython.display import Image import pydotplus
column_names = ['age','sex','chest pain','resting blood pressure','cholestrol','fasting blood sugar','resting ecg','max heart rate','excercise included','old peak','slp','caa','THALL','output'] data= pd.read_csv("heart.csv",header=None,names=column_names) data = data.iloc[1: , :] # removes the first row of dataframe (In this case, ) #split dataset in features and target variable feature_cols = ['age','sex','chest pain','chest pain','resting blood pressure','cholestrol','fasting blood sugar','resting ecg','max heart rate','excercise included','old peak','slp','caa','THALL'] pred = data[feature_cols] # Features tar = data.output # Target variable pred_train, pred_test, tar_train, tar_test = train_test_split(X, y, test_size=0.4, random_state=1) # 60% training and 40% test pred_train.shape pred_test.shape tar_train.shape tar_test.shape
# To create an object of Decision Tree classifer claf_mod = DecisionTreeClassifier() # Train the model claf_mod = claf_mod.fit(pred_train,tar_train) #Predict the response for test dataset tar_pred = claf_mod.predict(pred_test) sklearn.metrics.confusion_matrix(tar_test,tar_pred) # Model Accuracy, how often is the classifier correct? print("Accuracy:",metrics.accuracy_score(tar_test, tar_pred)) dot_data = StringIO() export_graphviz(claf_mod, out_file=dot_data, filled=True, rounded=True, special_characters=True,class_names=['0','1']) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_png('heart attack.png') Image(graph.create_png())
# Create Decision Tree classifer object claf_mod = DecisionTreeClassifier(criterion="entropy", max_depth=3) # Train Decision Tree Classifer claf_mod = claf_mod.fit(pred_train,tar_train) #Predict the response for test dataset tar_pred = claf_mod.predict(pred_test) # Model Accuracy, how often is the classifier correct? print("Accuracy:",metrics.accuracy_score(tar_test, tar_pred)) from sklearn.externals.six import StringIO from IPython.display import Image from sklearn.tree import export_graphviz import pydotplus dot_data = StringIO() export_graphviz(claf_mod, out_file=dot_data, filled=True, rounded=True, special_characters=True, class_names=['0','1']) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_png('improved heart attack.png') Image(graph.create_png())
1 note
·
View note
Text
Master NumPy Library for Data Analysis in Python in 10 Minutes
Learn and Become a Master of one of the most used Python tools for Data Analysis.
Introduction:-
NumPy is a python library used for working with arrays.It also has functions for working in domain of linear algebra, fourier transform, and matrices.It is an open source project and you can use it freely. NumPy stands for Numerical Python.
NumPy — Ndarray Object
The most important object defined in NumPy is an N-dimensional array type called ndarray. It describes the collection of items of the same type. Items in the collection can be accessed using a zero-based index.Every item in an ndarray takes the same size of block in the memory.
Each element in ndarray is an object of data-type object (called dtype).Any item extracted from ndarray object (by slicing) is represented by a Python object of one of array scalar types.
The following diagram shows a relationship between ndarray, data type object (dtype) and array scalar type −
It creates an ndarray from any object exposing array interface, or from any method that returns an array.
numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)
The above constructor takes the following parameters −
Object :- Any object exposing the array interface method returns an array, or any (nested) sequence.
Dtype : — Desired data type of array, optional.
Copy :- Optional. By default (true), the object is copied.
Order :- C (row major) or F (column major) or A (any) (default).
Subok :- By default, returned array forced to be a base class array. If true, sub-classes passed through.
ndmin :- Specifies minimum dimensions of resultant array.
Operations on Numpy Array
In this blog, we’ll walk through using NumPy to analyze data on wine quality. The data contains information on various attributes of wines, such as pH and fixed acidity, along with a quality score between 0 and 10 for each wine. The quality score is the average of at least 3 human taste testers. As we learn how to work with NumPy, we’ll try to figure out more about the perceived quality of wine.
The data was downloaded from the winequality-red.csv, and is available here. file, which we’ll be using throughout this tutorial:
Lists Of Lists for CSV Data
Before using NumPy, we’ll first try to work with the data using Python and the csv package. We can read in the file using the csv.reader object, which will allow us to read in and split up all the content from the ssv file.
In the below code, we:
Import the csv library.
Open the winequality-red.csv file.
With the file open, create a new csv.reader object.
Pass in the keyword argument delimiter=";" to make sure that the records are split up on the semicolon character instead of the default comma character.
Call the list type to get all the rows from the file.
Assign the result to wines.
We can check the number of rows and columns in our data using the shape property of NumPy arrays:
Indexing NumPy Arrays
Let’s select the element at row 3 and column 4. In the below code, we pass in the index 2 as the row index, and the index 3 as the column index. This retrieves the value from the fourth column of the third row:
1-Dimensional NumPy Arrays
So far, we’ve worked with 2-dimensional arrays, such as wines. However, NumPy is a package for working with multidimensional arrays. One of the most common types of multidimensional arrays is the 1-dimensional array, or vector.
1.Just like a list of lists is analogous to a 2-dimensional array, a single list is analogous to a 1-dimensional array. If we slice wines and only retrieve the third row, we get a 1-dimensional array:
2. We can retrieve individual elements from third_wine using a single index. The below code will display the second item in third_wine:
3. Most NumPy functions that we’ve worked with, such as numpy.random.rand, can be used with multidimensional arrays. Here’s how we’d use numpy.random.rand to generate a random vector:
After successfully reading our dataset and learning about List, Indexing, & 1D array in NumPy we can start performing the operation on it.
The first element of each row is the fixed acidity, the second is the volatile ,acidity, and so on. We can find the average quality of the wines. The below code will:
Extract the last element from each row after the header row.
Convert each extracted element to a float.
Assign all the extracted elements to the list qualities.
Divide the sum of all the elements in qualities by the total number of elements in qualities to the get the mean.
NumPy Array Methods
In addition to the common mathematical operations, NumPy also has several methods that you can use for more complex calculations on arrays. An example of this is the numpy.ndarray.sum method. This finds the sum of all the elements in an array by default:
2. Sum of alcohol content in all sample red wines
NumPy Array Comparisons
We get a Boolean array that tells us which of the wines have a quality rating greater than 5. We can do something similar with the other operators. For instance, we can see if any wines have a quality rating equal to 10:
3. select wines having pH content > 5
Subsetting
We select only the rows where high_Quality contains a True value, and all of the columns. This subsetting makes it simple to filter arrays for certain criteria. For example, we can look for wines with a lot of alcohol and high quality. In order to specify multiple conditions, we have to place each condition in parentheses, and separate conditions with an ampersand (&):
4. Select only wines where sulphates >10 and alcohol >7
5. select wine having pH greater than mean pH
We have seen what NumPy is, and some of its most basic uses. In the following posts we will see more complex functionalities and dig deeper into the workings of this fantastic library!
To check it out follow me on tumblr, and stay tuned!
That is all, I hope you liked the post. Feel Free to follow me on tumblr
Also, you can take a look at my other posts on Data Science and Machine Learning here. Have a good read!
1 note
·
View note
Text
Direct WAV Mp3 Splitter
You can convert 1 format into another (like MP3 to WAV, MP3 to WMA, WAV to MP3, WMA to MP3, M4A to MP3 and so on.) , or convert MP3, WAV, WMA, OGG, FLAC, APE, MPC to indistinguishable format nonetheless with completely distinct encoding. Parameters (such as sample fee, bitrate, etc.). The M4A file format is not just a household name, coming in much behind the vastly additional common MP3 format. But, that doesn't mean it's irrelevant. The WAV file is composed of three"chunks" of knowledge: The RIFF chunk which identifies the file as a WAV file, The FORMAT chunk which identifies parameters like sample cost along with the INFORMATION chunk that integrates the actual data (samples). View MP3 WAV Converter.
The very best WAV to MP3 Converter which has a free trial version will be iSkysoft iMedia Converter Deluxe. This software application is an audio converter which supports completely distinct input and output codecs. It Is Possible to input formats such as WAV, MP3, APE, MKA, AU, FLAC, CAF and output formats such as MP3, AAC, OGG, M4A, APE SD2 and AIFF. Run WMA to MP3 Converter, only click on the"Insert Video(s)" button to select WMA audio data from the hard disk.
Blackboard Ally is a program which is employed alongside Blackboard to examine recordsdata and convert them to quite a great deal of accessible formats into greater assist pupils with disabilities, said Associate Director of eLearning and Emerging Applied sciences Eric Kunnen. Click Profile on the top rated right corner, select MP3 Audio as output sound format in the drop down checklist. You also can pick another output sound format in case you just happen to enjoy, like FLAC, WAV, AAC, M4A and OGG.
However, this technique doesn't match to compress sound files inside the next group. Should you would like to compress them to smaller document size, odds are you're confer with Strategy 2. M4A stands for MPEG 4 Audio and can be a filename extension used to represent sound files. Home windows Media Audio (WMA) is a sound data compression experience developed by Microsoft. The title may be used to check its sound file format or its own sound codecs.
WAV to MP3 Converter converts WAV into MP3 and vice versa in batch. The computer software is an ALL-IN-ONE audio converter which supports over a hundred and fifty sound and video data as input and sparks 30 sound codecs, and retains ID3 tag when switching. Shifting from M4A to MP3 is a secure path of and you are able to share the download link of your document to your email in case that you would like to. M4A is a file extension for sound file encoded with innovative audio coding that's a lossy compression.MP3 is a standard expertise and format for compressing a sound sequence into a very small file.
Select one or more FLAC files you need to convert. Just convert your DRM protected and some other non-protected music and movie files to MP3, M4A (iPod), WMA or WAV (sound ) and MP4, AVI (DivX) or WMV (movie ) at elevated speed and CD quality -- lawfully. Employed as a powerful MP3 Compressor, Faasoft Audio Compressor delivers a remedy to compress MP3 recordsdata to smaller dimensions. Employed as a strong WAV Compressor, Faasoft Audio Compressor also has the use of compressing WAV data as your own need.
1 day past. Wish to covert audiowav advice to textual content with python v3 Sphinx module, its functioning fine but disadvantage is it's taking extended time for largewav recordsdata and I have connected my code directly here. mp3. MP3 Audio Format. Is the most normal format for storing sound. Just about any player on any stage may open mp3 recordsdata. The sound is compressed with deficiency of quality, no matter how the reduction is negligible to the user, and also the document size is generally lower than the distinctive files.
The following will present a step-by-step advice on discover how to compress different sound files to smaller document size with the support of this exceptionally effective Audio Compressor software application -- Bigasoft Audio Converter. AnyTrans to get iOS as a ringtone manager supports music types collectively with MP3, M4A, m4a wav video converter free download M4R, WMA, WAV, RM, MDI, OGG, FLAC. Robotically convert your self explanatory ringtone to M4R format. The moment the ringtone is created, it should be inside the M4R format that might be instantly transferred to a iOS program or saved into your PC.
Get More Information here on anyconv.com.
1 note
·
View note
Text
The gang’s all here!
"Welcome every-hermit! To the annual Partner Problem event! This is our first year getting everyone to play, so welcome!" X smiled as the crowd of hermits below him cheered. "I'll explain the rules for the newbies."
"I will draw two names out of a helmet. Those two people will be fitted with curse of binding boots, which magically link the pair. These boots will force you to stay within 3 meters, or 10 feet, of each other. You will wear the boots for 24 hours, and then the spell will dissolve. Make sense?"
Heads bobbed in agreement.
"Then let's begin!" X picked up the helmet at his feet, shuffling the papers inside. "Zedaph..."
Zed jumped, excitedly looking around for who his partner might be.
"...and Welsknight!"
There were assorted congratulations as Wels and Zed found each other, grinning excitedly.
"Alright, quiet down! Next up: Tango and Iskall!"
Laugher and groans. The two pranksters high-fived, already whispering mischievously.
"Stress and Grian! False and Jevin! Scar and Python!" X rattled off the names, each greeted with excitement. "Me and Cub! Cleo and Mumbo! Impulse and Joe! Docm and biffa! Rendog and TFC! And that's everyone! Line up to get your boots, and thanks for coming out!" X glided down from his make-shift pedestal, throwing open a chest full of glowing leather boots.
The hermits filed through with their partners, pulling on their new boots and testing the limits. Slowly, the plateau emptied, everyone heading their ways for the day.
—
"Work with me here, love!" Stress laughed, trying to pull Grian away from the store window.
"Sorry! They made a new tnt, and this one is player-friendly!" Grian hopped up, beaming as he returned to Stress' side.
"We can check it out after I return Impulse's backup elytra he let me borrow. It's been a couple weeks and I need to return them!"
"What ho, and salutations!" Joe waved as he and Impulse appeared over the ridge.
"Hi Joe! Impulse! How are you doing?"
"Really well! We're taking turns picking the pass time, so it's been fine."
"We were just on our way to Impulse's home behind the sea foam." Joe gestured in the direction of Impulse's bay area.
"How delightful! Well, I just wanted to return your elytra I borrowed. Thanks again!" Stress handed over the wings, which Impulse accepted gratefully.
"I was wondering where I left those, thanks!"
"Okay, can we go look at the tnt now?" Grian shifted back and forth, glancing back at the tnt.
"Fine. As long as we can go ice mining later for my castle." Stress threw a humorous look at Joe and Impulse as Grian rushed back to the storefront. "Bye!"
"Those two must be having a ball." Joe remarked as he and Impulse calmly continued their stroll.
—
"So this is the vault, huh?" Ren gaped as TFC led him down.
"Sure is."
"Wow... It's so big..."
"Thanks, I've put a lot of time into it."
"Tin, how did you find the time to do all this?" Ren peeked through a door, taking everything in.
"I've just cracked down and worked hard, that's all." TFC pulled some stone out of a chest without slowing his walk, heading for the next room he needed to finish.
"Woah, that was slick! You didn't even stop walking, you just grabbed that stone, like Whoosh!" Ren exclaimed, swooping his hand through the air.
"Oh, you know it. This way."
The large vault narrowed to a corridor, which the two squeezed through, reaching a decent-sized room, half excavated. Tin set right to work, mining at the wall with one hand and picking up the stone with the other. The older man relaxed in his element, killing a zombie without hesitation when it crept up on him. Ren simply watched in awe at the grace. He was startled out of his trance, however, when TFC tugged on their binding boots.
"I gotta put some stuff away, come on."
Ren followed slowly. "That was crazy. Like, you were just mining, but it was like a dance! Does that make sense? We don't need to go to my base later, we can just stay here for all 24 hours! Can I help?"
Tin rubbed his temples as he tossed the last of the stone in a chest. "You can have the most important job of all."
Ren perked up. "The most important?!"
"Hold these." Tin shoved a bunch of shulker boxes into his arms.
TFC set back to work, tossing the stone into the boxes as he went. Ren didn't mind holding the stone- he was just glad to be part of the process.
"This is fantastic! Why don't we hang out more often? You're so cool Tin!" Ren babbled on in excitement over the menial labor.
"Hey Ren-" TFC quickly cut in. "If you don't talk, I'll do something cool."
Ren gasped loudly, and sealed his lips. Tin shook his head, silently laughing as he dual-wielded a second pickaxe, blowing Ren's mind.
—
Well hullo!" Cleo and Mumbo waved as they approached Scar and Python. The two were sitting in the grass outside Scar's terraforming shop, flower crowns and necklaces all around them.
"Heya! How are you two?" Scar greeted as Mumbo and Cleo sat next to them.
"Pretty good! Neither of us had a whole lot to do, so we're visiting everyone else. What are you doing?" Cleo picked at the grass.
"We've been making flower chains! Wanna learn how?" Python displayed the chain he was currently working on.
"Absolutely!"
The four hermits soaked up the sun as they weaved flower crowns, half-asleep from its warmth and sweet aroma. At some point, False and Jevin stumbled by, tears of laughter streaming down their faces.
"How's it going?" Scar giggled, already knowing the answer.
"Could be better-" False wheezed, wiping her tears. "May we-?"
Jevin and False tripped over each other and collapsed in a pile of giggles. The group talked and laughed for hours, while the sun slowly fell. The stars twinkled into sight, and they fell asleep stargazing.
—
"Alright," Tango breathed. Iskall nodded, and they slowly dipped their wings in sync. After practicing all day, they were finally coordinated enough to cause some mischief.
Two glowing dots walked the grounds outside the newest ConCorp studio- two hermits holding torches in the night.
"Cub and X?" Iskall whispered into the dark. Tango nodded, pulling out a stack of eggs.
"Ready... GO!"
Cackling loudly, Iskall and Tango pelted the ground with eggs, watching X and Cub dance away from them. One figure glanced up, spotting the pair in the air, and shook their fist dramatically.
"You're not even Poultry man!" X's voice called after them, but they were already flying away.
"Fan-frickin-tastic!" Iskall howled.
"They thought we were poultry man!" Tango slapped his leg. The wild excitement distracted him, and Tango wobbled before plummeting to the earth.
"Gah!!" Iskall spammed rockets, desperate to stay in the air. However, Tango's limp body dragged him down, and the two splashed into the water violently. The sounds of drowneds instantly lit a fire under them, and they paddled tiredly to the shore.
"Hehe, worth it." Iskall wiped his hair from his face, sand getting everywhere.
Tango panted as he collapsed on the sand. "Absolutely."
—
"Huzzah!" Zedaph triumphantly held up the blue parrot. He and Wels had been searching the jungle for hours, and this was the first bird they found. They were tired and bruised, but it was worth it.
"Did you hear that?" Wels whispered.
Zed rolled his eyes. "For the last time, Wels, it was probably an ocelot. We can sail home if you'd feel better about it?"
"Yes please!" Wels sighed in relief as they made their way to the shore. The rustle of leaves behind them made Wels jump again. "Let's go." He glanced over his shoulder as he pulled out a boat.
"SNEAK ATTACK!" Doc and Biffa lunged from the bushes, diamond swords drawn. Their armor and faces were coated with mud and leaves, their binding boots streaked with war paint. Somebody screeched (cough Zedaph) and everything happened all at once.
Suddenly, the attack was over as soon as it started. Biffa ran too far ahead of Doc, and the two tumbled into the sand at Zed's feet.
Doc looked up bashfully, his helmet falling from his head. "Fancy meeting you here.."
Zed blinked. "...Well now I don't think this is a coincidence, us meeting in the jungle like this, you crying Sneak Attack!! But okay!" Zed laughed, releasing his tension.
"I suppose our mission was a failure, then?" Biffa sighed with a grin.
"I suppose so- but you did scare Wels pretty well!" Zed patted Wels on the head, as he had fallen over in his freight.
"I told you so!!"
#it's the whole gang!#rae writes#hermitcraft#iskall#xisuma#mumbo jumbo#grian#rendog#docm#biffa#welsknight#zedaph#tangotek#impulsesv#falsesymmetry#zombiecleo#stressmonster#tinfoilchef#pythongb#goodtimeswithscar#cubfan#jevin#joehills#phew thats a lotta tags
108 notes
·
View notes
Text
Version 379
youtube
windows
zip
exe
macOS
app
linux
tar.gz
source
tar.gz
Happy New Year! Although I have been ill, I had a great week, mostly working on a variety of small jobs. Search is faster, there's some new UI, and m4a files are now supported.
search
As hoped, I have completed and extended the search optimisations from v378. Searches for tags, namespaces, wildcards, or known urls, particularly if they are mixed with other search predicates, should now be faster and less prone to spikes in complicated situations. These speed improvements are most significant on large clients with hundreds of thousands or millions of files.
Also, like how system:inbox and system:archive 'cancel' each other out, a few more kinds of search predicate will remove mutually exclusive or redundant predicates already in the search list. system:limit predicates will remove other system:limits, system:audio/no audio will nullify each other, and--I may change this--any search predicate will replace system:everything. I have a better system for how this replacement works, and in the coming weeks I expect to extend it to do proper range-checking, so a system:filesize<256KB will remove a system:filesize<1MB or system:filesize<16KB or system:filesize>512KB, but not a system:filesize>128KB.
downloaders
I have started on some quality of life for the downloader UI. Several of the clunky buttons beneath the page lists are now smaller icons, you can now 'retry ignored' files from a button or a list right-click, any file import status button lets you right-click->show all/new in a new page, and the file import status list now lets you double-click/enter a selection to show that selection in a new page.
I have rolled in a fixed derpibooru downloader into the update. It seems to all work again.
With the pixiv login script confirmed completely broken with no easy hydrus fix in sight, if you have an 'active' record with the old, now-defunct default pixiv login script, this week's update will deactivate it and provide you with a note and a recommendation to use the Hydrus Companion web browser addon in order to login.
the rest
m4a files are now supported and recognised as audio-only files. These were often recognised as mp4s before--essentially, they are just mp4s with no video stream. I have made the choice for now to recognise them as audio-only even if they have a single frame 'jpeg' video stream. I hope to add support to hydrus for 'audio+picture' files soon so I can display album art better than inside a janked single-frame video.
The 'remove' and 'select' menus on the thumbnail right-click have been improved and harmonised. Both now lay out nicely, with file service options (like 'my files' vs 'trash' when there is a mix), and both provide file counts for all options. Support for selecting and removing from collected media is also improved.
full list
downloaders:
the right-click menus from gallery and watcher page lists now provide a 'remove' option
gallery and watchers now provide buttons and menu actions for 'retry ignored'
activating a file import status list (double-clicking or hitting enter on a selection of rows) now opens the selection in a new page
file import status buttons now have show new/all files on their right-click menus
on gallery and watcher pages, the highlight, clear highlight, pause files, and pause search/check buttons are now smaller bitmap buttons
as the old default pixiv login script is completely broken, any client with this active will have it deactivated and receive an update popup explaining the situation and suggesting to use Hydrus Companion for login instead
updated the derpibooru downloader
.
search:
when search predicates are added to the active search list, they are now better able to remove existing mutually exclusive/redundant predicates:
- system:limit, hash, and similar to predicates now remove other instances of their type
- system:has audio now removes system:no audio and vice versa
- any search predicate will remove system:everything (see how you feel about this)
improved 378's db optimisation to do tag searches in large file domains faster
namespace search predicates ('character:anything' etc...) now take advantage of the same set of temporary file domain optimisations that tag predicates do, so mixing them with other search predicates will radically improve their speed
wildcard search predicates, which have been notoriously slow in some cases, now take full advantage of the new tag search optimisations and are radically faster when mixed with other search predicates
simple tag, namespace, or wildcard searches that are mixed with a very large system:inbox predicate are now much faster
a variety of searches that include simple system predicates are now faster
integer tag searches also now use the new tag search optimisation tech, and are radically faster when mixed with other search predicates
system:known url queries now use the same temporary file domain search optimisation, and a web-domain search optimisation. this particularly improves domain and url class searches
fixed an issue with the new system:limit sorting where sort types with non-comprehensive data (like media views/viewtime, where files may not yet have records) were not delivering the 'missing' file results
improved the limit/sort_by logic to only do sort when absolutely needed
fixed the system:limit panel label to talk about the new sorted clipping
refactored tag searching code
refactored namespace searching code
refactored wildcard searching code and its related subfunctions
cleaned all mappings searching code further
.
the rest:
m4a files (and m4b) are now supported and recognised as separate audio-only mp4 files. files with a single jpeg frame for their video stream (such as an album cover) should also be recognised as audio only m4a for hydrus purposes for now. better single-frame audio support, including functional thumbnails and display, is planned for the future. please send in any m4a or m4b files that detect incorrectly
the remove thumbnail menu has been moved to a new, cleaner file filtering system. it now presents remove options for different file services and local/remote when available (most of the time, this will be 'my files'/'trash' appearing when there is a mix), including with counts for all options
the select thumbnail menu is also moved to this same file filtering system. it has a neater menu, with counts for each entry. also, when there is no current focus, or it is to be deselected, the first file to be selected is now focused and scrolled to
for thumbnail icon display and internal calculations, collections now _merge_ the locations of their members, rather than intersecting. if a collection includes any trash, or any ipfs members, it will have the appropriate icon. this also fixes some selection-by-file-service logic for collections
import folders, export folders, and subscriptions now explicitly only start after the first session has been loaded (so as well as freeing up some boot CPU competition, a quick import folder will now not miss publishing a file or two to a long-loading session)
the subscription manager now only waits 15s before starting first work (previously, the buffer was 60 seconds)
rearranged migrate tags panel so action comes before destination and added another help text line to clarify how it works. the 'go' confirmation dialog now summarises tag filtering as well
tag filter buttons now have a prefix on their labels and tooltips to better explain what they are doing
the duplicate filter right-center hover window should now shorten its height appropriately when the pairs change
fixed a couple of bugs that could appear when shutting down the duplicate filter
hackily 'fixed' an issue with duplicates processing that could cause too many 'commit and continue?' dialogs to open. a better fix here will come with a pending rewrite
dejanked a little of how migrate tags frame is launched from the manage tags dialog
updated the backup help a little and added a note about backing up to the first-start popup
improved shutdown time for a variety of situations and added a couple more text notifications to shutdown splash
cleaned up some exit code
removed the old 'service info fatten' maintenance job, which is not really needed any more
misc code cleanup
updated to Qt 5.14 on Windows and Linux builds, OpenCV 4.1.2 on all builds
next week
Next week is a 'medium size job' week. Now I am more comfortable with Qt, I would love to see if I can get an MPV window embedded into hydrus so we finally have legit video+audio support. I can't promise I can get anything but a rough prototype ready for 380 for all platforms, and there is a small chance it just won't work at all, but I'll give it a go.
Hydrus had a busy 2019. Starting with the jump to python 3, and then the duplicate storage and filter overhaul, the Client API, OR search, proper audio detection, the file maintenance system, multiple local tag services, tag migration, asynchronous repository processing, fast tag autocomplete, and all the smaller improvements to downloaders and UI workflow and latency and backend scheduling and optimisations for our growing databases, and then most recently with the huge Qt conversion. The wider community also had some bumps, but we survived. Now we are in 2020, I am feeling good and looking forward to another productive year. There are a couple of thousand things I still want to do, so I will keep on pushing and try to have fun along the way. I hope you have a great year too!
2 notes
·
View notes
Text
How To Convert MP3 To WAV In Python
YouTube is the preferred video sharing web site in the entire world that so that you can grab or add movies. Step 1 Open this website and then choose information you want to convert to upload. Help for Cowl Art Obtain and add album covers to your files and make your library even more shiny. The final motion that you must take is to click on the Start button to begin the audio conversion course of. Sorry for the inconvenience. Earlier than changing the video tomp3 format, try to play it using RealPlayer and let us know the standing. With our browser addons you'll be able to rapidly and simply convert your , mp3 Mp2 Difference and movies tomp3 (music) ormp4 (video) recordsdata immediately from the video portals. First, choose which audio file you want to have lower and add them. You'll be able to add them from Dropbox, Google Drive, by means of an online link, or immediately from your computer. Audio cutter utility lets you trim your music recordsdata to take away silence, or undesirable sections. Convert Video to MP3, MP3 Cutter, MP3 Converter, Audio Converter, Ringtone Maker, Ringtone Cutter, Minimize Songs Online, Audio Trimming Software, WAV to MP3, MP4 to MP3, FLV to MP3, WMA to MP3, OGG to MP3, FLAC to MP3, M4A to mp3 mp2 difference, MP3 to WAV, Increase Volume of MP3, Decrease Volume of MP3, Fade in And Fade out Audio, and so forth. "SO COOL." An excellent obtain software which supports more video codecs than others I've used. Versatile toolbox consists of fixing video metadata, mp3 mp2 difference GIF maker, casting video to TV, VR converter and screen recorder. Through the use of our converter you may simply convert YouTube videos to mp3 (audio) or mp4 (video) information and download them without cost - this service works for computer systems, tablets and cellular gadgets. On this article we'll talk about audio encoding settings that have an effect on the quality of sound. Understanding the conversion settings can assist you select the optimal sound encoding properties in phrases of file measurement relative to sound high quality. Free Convert MP3 to WAV is very to use. Merely add the audio information to transform, select the target audio format and high quality profile and then press the "Convert" button. However, the demo model is severely restricted (as you possibly can see within the Product Description beneath). Nevertheless it still affords a person-pleasant atmosphere in which you can absolutely check Xilisoft WMA MP3 Converter's capabilities. We strongly recommend this software program to all customers. It's essential to want "Free Music Download app" & in that Faucet the Share button and Faucet the Download button. To make this app a music participant you'll be able to truly use, there's a playlist function as effectively. You'll be able to add a music to a playlist utilizing the Share button. Go to the Information part to view your downloaded songs. Initially, there is no registration and no set up necessary for it, which is actually handy. Totally appropriate with latest internet browser, this on-line video converter can give you a brilliant fast conversion. On the similar time, it might guarantee the quality of the converted files is sweet if you convert MP2 to MP3. MKV to MP3 Converter a strong audio extractor extracting audio from video. It permits converting MKV Video to MP3 simply. Key features: Batch-convert unlimited Video recordsdata within the fast and straightforward setup interface; Extractor Video files into custom file sizes to be used with portable MP3 players; You possibly can customise the size of output file and its Bitrate shall be calculated robotically; Multithreading are supported and the more information you convert the quicker; Simple to use - Simply two clicks, everybody can change into the master of MKV to MP3 Converter; Routinely shutdown the computer after conversion. In the event you solely have a couple of small information to convert, we suggest using one of many free applications we reviewed. The benefit of spending $30 on audio conversion software is the flexibility to convert a lot of information quickly. Audials Tunebite is $forty, which is the costliest software we examined, but it will probably file streaming audio and video services and converts greater than 40 import formats.
After a number of upgrades, iOrgsoft Audio Converter has improve the output high quality tremendously. Whereas changing audio and video to audio, it will possibly perfectly stay the unique audio high quality and can output audio with bit charge as much as 256kbps with ease. man i am loving this program i am using media human audio converter and i'm convertings 186 music recordsdata it has taken lower than 5 minutes normally the other packages i exploit if i used to be doing this it might take about an hour to an hour and a half this applications is the perfect.Converts any youtube video to a high quality small mp3 file. It is quite easy to set the video quality you need like 3D video download, HD video obtain when changing the movies with the excellent Bigasoft Video Downloader Professional. A: It's easy! Simply click the MP3 to MP2 Converter download button on the web page. Clicking this link will start the installer to download MP3 to MP2 Converter free for Windows.
1 note
·
View note
Text
Using Python to recover SEO site traffic (Part three)
When you incorporate machine learning techniques to speed up SEO recovery, the results can be amazing.
This is the third and last installment from our series on using Python to speed SEO traffic recovery. In part one, I explained how our unique approach, that we call “winners vs losers” helps us quickly narrow down the pages losing traffic to find the main reason for the drop. In part two, we improved on our initial approach to manually group pages using regular expressions, which is very useful when you have sites with thousands or millions of pages, which is typically the case with ecommerce sites. In part three, we will learn something really exciting. We will learn to automatically group pages using machine learning.
As mentioned before, you can find the code used in part one, two and three in this Google Colab notebook.
Let’s get started.
URL matching vs content matching
When we grouped pages manually in part two, we benefited from the fact the URLs groups had clear patterns (collections, products, and the others) but it is often the case where there are no patterns in the URL. For example, Yahoo Stores’ sites use a flat URL structure with no directory paths. Our manual approach wouldn’t work in this case.
Fortunately, it is possible to group pages by their contents because most page templates have different content structures. They serve different user needs, so that needs to be the case.
How can we organize pages by their content? We can use DOM element selectors for this. We will specifically use XPaths.
For example, I can use the presence of a big product image to know the page is a product detail page. I can grab the product image address in the document (its XPath) by right-clicking on it in Chrome and choosing “Inspect,” then right-clicking to copy the XPath.
We can identify other page groups by finding page elements that are unique to them. However, note that while this would allow us to group Yahoo Store-type sites, it would still be a manual process to create the groups.
A scientist’s bottom-up approach
In order to group pages automatically, we need to use a statistical approach. In other words, we need to find patterns in the data that we can use to cluster similar pages together because they share similar statistics. This is a perfect problem for machine learning algorithms.
BloomReach, a digital experience platform vendor, shared their machine learning solution to this problem. To summarize it, they first manually selected cleaned features from the HTML tags like class IDs, CSS style sheet names, and the others. Then, they automatically grouped pages based on the presence and variability of these features. In their tests, they achieved around 90% accuracy, which is pretty good.
When you give problems like this to scientists and engineers with no domain expertise, they will generally come up with complicated, bottom-up solutions. The scientist will say, “Here is the data I have, let me try different computer science ideas I know until I find a good solution.”
One of the reasons I advocate practitioners learn programming is that you can start solving problems using your domain expertise and find shortcuts like the one I will share next.
Hamlet’s observation and a simpler solution
For most ecommerce sites, most page templates include images (and input elements), and those generally change in quantity and size.
I decided to test the quantity and size of images, and the number of input elements as my features set. We were able to achieve 97.5% accuracy in our tests. This is a much simpler and effective approach for this specific problem. All of this is possible because I didn’t start with the data I could access, but with a simpler domain-level observation.
I am not trying to say my approach is superior, as they have tested theirs in millions of pages and I’ve only tested this on a few thousand. My point is that as a practitioner you should learn this stuff so you can contribute your own expertise and creativity.
Now let’s get to the fun part and get to code some machine learning code in Python!
Collecting training data
We need training data to build a model. This training data needs to come pre-labeled with “correct” answers so that the model can learn from the correct answers and make its own predictions on unseen data.
In our case, as discussed above, we’ll use our intuition that most product pages have one or more large images on the page, and most category type pages have many smaller images on the page.
What’s more, product pages typically have more form elements than category pages (for filling in quantity, color, and more).
Unfortunately, crawling a web page for this data requires knowledge of web browser automation, and image manipulation, which are outside the scope of this post. Feel free to study this GitHub gist we put together to learn more.
Here we load the raw data already collected.
Feature engineering
Each row of the form_counts data frame above corresponds to a single URL and provides a count of both form elements, and input elements contained on that page.
Meanwhile, in the img_counts data frame, each row corresponds to a single image from a particular page. Each image has an associated file size, height, and width. Pages are more than likely to have multiple images on each page, and so there are many rows corresponding to each URL.
It is often the case that HTML documents don’t include explicit image dimensions. We are using a little trick to compensate for this. We are capturing the size of the image files, which would be proportional to the multiplication of the width and the length of the images.
We want our image counts and image file sizes to be treated as categorical features, not numerical ones. When a numerical feature, say new visitors, increases it generally implies improvement, but we don’t want bigger images to imply improvement. A common technique to do this is called one-hot encoding.
Most site pages can have an arbitrary number of images. We are going to further process our dataset by bucketing images into 50 groups. This technique is called “binning”.
Here is what our processed data set looks like.
Adding ground truth labels
As we already have correct labels from our manual regex approach, we can use them to create the correct labels to feed the model.
We also need to split our dataset randomly into a training set and a test set. This allows us to train the machine learning model on one set of data, and test it on another set that it’s never seen before. We do this to prevent our model from simply “memorizing” the training data and doing terribly on new, unseen data. You can check it out at the link given below:
Model training and grid search
Finally, the good stuff!
All the steps above, the data collection and preparation, are generally the hardest part to code. The machine learning code is generally quite simple.
We’re using the well-known Scikitlearn python library to train a number of popular models using a bunch of standard hyperparameters (settings for fine-tuning a model). Scikitlearn will run through all of them to find the best one, we simply need to feed in the X variables (our feature engineering parameters above) and the Y variables (the correct labels) to each model, and perform the .fit() function and voila!
Evaluating performance
After running the grid search, we find our winning model to be the Linear SVM (0.974) and Logistic regression (0.968) coming at a close second. Even with such high accuracy, a machine learning model will make mistakes. If it doesn’t make any mistakes, then there is definitely something wrong with the code.
In order to understand where the model performs best and worst, we will use another useful machine learning tool, the confusion matrix.
When looking at a confusion matrix, focus on the diagonal squares. The counts there are correct predictions and the counts outside are failures. In the confusion matrix above we can quickly see that the model does really well-labeling products, but terribly labeling pages that are not product or categories. Intuitively, we can assume that such pages would not have consistent image usage.
Here is the code to put together the confusion matrix:
Finally, here is the code to plot the model evaluation:
Resources to learn more
You might be thinking that this is a lot of work to just tell page groups, and you are right!
Mirko Obkircher commented in my article for part two that there is a much simpler approach, which is to have your client set up a Google Analytics data layer with the page group type. Very smart recommendation, Mirko!
I am using this example for illustration purposes. What if the issue requires a deeper exploratory investigation? If you already started the analysis using Python, your creativity and knowledge are the only limits.
If you want to jump onto the machine learning bandwagon, here are some resources I recommend to learn more:
Attend a Pydata event I got motivated to learn data science after attending the event they host in New York.
Hands-On Introduction To Scikit-learn (sklearn)
Scikit Learn Cheat Sheet
Efficiently Searching Optimal Tuning Parameters
If you are starting from scratch and want to learn fast, I’ve heard good things about Data Camp.
Got any tips or queries? Share it in the comments.
Hamlet Batista is the CEO and founder of RankSense, an agile SEO platform for online retailers and manufacturers. He can be found on Twitter @hamletbatista.
The post Using Python to recover SEO site traffic (Part three) appeared first on Search Engine Watch.
from Digtal Marketing News https://searchenginewatch.com/2019/04/17/using-python-to-recover-seo-site-traffic-part-three/
2 notes
·
View notes
Text
Imageoptim linux

IMAGEOPTIM LINUX INSTALL
IMAGEOPTIM LINUX UPDATE
IMAGEOPTIM LINUX MANUAL
IMAGEOPTIM LINUX SOFTWARE
What is the best image format for websites?.
What is the best image optimizer for WordPress?.
How do I optimize photos on my computer?.
Use the Adwaita theme by default on Windows as the Windows10 GTK theme.
Image previews now honor the JPEG orientation EXIF tag.
Fix image previews: no more ugly thumbnails with indexed images.
Do not allow to remove images with the key while an.
Multiselection: Multiple files can now be selected and their parameters can.
Allow to resize images (downscale only, preserve ratio).
Do not optimize again images that have already been optimized.
Display a "Canceled" status on non-optimized image while the "Stop".
The "Stop" button now stops the running optimizations and not only the.
"Optimize" and "Stop" buttons behaviour improved:.
Setting the default output locations / name or pattern of output files.
Number of threads used to optimize images.
Theme selection / dark theme preference.
YOGA can no more output a PNG larger than the input one when performing.
JPEG optimization improved: up to 7.3 % of additional size reduction.
Fix the abnormal amount of processes created (and not cleaned) when.
(changes on master but not released yet):.
IMAGEOPTIM LINUX INSTALL
On Debian / Ubuntu, they can be installed with the following command: sudo apt install gettext NOTE: you will need to have xgettext, msgmerge and msgfmt executable installed on your system to run the above commands. To compile locales, run: nox -session locales_compile
IMAGEOPTIM LINUX UPDATE
To extract messages and update locales run: nox -session locales_update You can also fix automatically coding style errors with: nox -s black_fix To run the tests only for a specific Python version, you can use following commands (the corresponding Python interpreter must be installed on your machine): nox -session test-3.7 Then you can check for lint error: nox -session lint You will first have to install nox: pip3 install nox Do not forget to add your name as the translation of the translator-credits key (one name per line, e-mail is optional): #: yoga_image_optimizer/about_dialog.py:38 To translate YOGA Image Optimizer, you can submit your translations using a Pull Request on Github.
IMAGEOPTIM LINUX SOFTWARE
If the software is not available in your language, you can help translating it. Flake8 and Black are used on this project to enforce coding style. Please note that your code must pass tests and follow the coding style defined by the pep8. This is of course not necessary if you just want to fix some typo or small errors in the code. This will allow us to discuss the best way to do it. Please consider filing a bug before starting to work on a new feature.
All the logs and message outputted by the software,.
What is your operating system / Linux distribution (and its version),.
If you found a bug, please open an issue on Github with as much information as possible:
or ask on Discord (I am not always available for chatting but I try to answer to everyone).
You can also pass some image files to open: yoga-image-optimizer image1.png image2.jpeg To run YOGA Image Optimizer, just type the following command: yoga-image-optimizer zip version or the Windows installer from the release page: You will not be able to run the software from your graphical app menu (GNOME Shell.). NOTE: Installing from PyPI will not install. Then install YOGA Image Optimizer using pip: sudo pip3 install yoga-image-optimizer
IMAGEOPTIM LINUX MANUAL
įinally, you can install desktop file, icons and manual using the following command: sudo. Then install YOGA Image Optimizer using pip: sudo pip3 install. Then clone this repository and navigate to it: git clone On Debian and Ubuntu this can be achieved with the following command: sudo apt install git build-essential python3 python3-dev python3-pip libgirepository1.0-dev libcairo2-dev pkg-config gir1.2-gtk-3.0 This is currently the simplest way to install YOGA Image Optimizer on all major Linux distributions:įirst, you will need to install some dependencies on your system. The package is available on AUR ( yoga-image-optimizer):Ī Flatpak package is available on Flathub.

0 notes